This is an old revision of the document!
Start Page » DragonScript Scripting Language » Behavior Elements: Quick and Easy Development » ECBehaviorCamera
Behavior element behavior adding camera support.
Behavior adds a Camera resource to the the behavior element. Creates a camera attached to the element collider which can be individually modified.
This behavior can be added multiple times to an element. Use the behavior identifier to tell them apart.
Element class properties have the prefix camera. or camera({id}). if id is not empty.
Set position to attach resource to collider.
camera.position or camera({id}).position<vector name='camera.position' x='0' y='0' z='0.1'/>
Set orientation to attach resource to collider in degrees.
camera.orientation or camera({id}).orientation<vector name='camera.orientation' x='30' y='0' z='0'/>
Set bone to attach resource to. If empty string attach to collider.
camera.bone or camera({id}).bone<string name='camera.bone'>attach</string>
Set vertical field of view in degrees for the entire view.
customColor.fov or customColor({id}).fov<float name='customColor.fov'>60</value>
Set aspect ratio of the horizontal field of view to the vertical field of view.
customColor.fovRatio or customColor({id}).fovRatio<float name='customColor.fovRatio'>1.5</value>
Set distance to the image plane.
customColor.imageDistance or customColor({id}).imageDistance<float name='customColor.imageDistance'>0.1</value>
Set viewing distance up to which world geometry is rendered.
customColor.viewDistance or customColor({id}).viewDistance<float name='customColor.viewDistance'>500</value>
Set enable high definition range rendering (HDRR) if supported.
customColor.enableHDRR or customColor({id}).enableHDRR<float name='customColor.enableHDRR'>false</value>
Set exposure.
customColor.exposure or customColor({id}).exposure<float name='customColor.exposure'>1.5</value>
Set lowest intensity the eye can adapt to.
customColor.lowestIntensity or customColor({id}).lowestIntensity<float name='customColor.lowestIntensity'>10</value>
Set highest intensity the eye can adapt to.
customColor.highestIntensity or customColor({id}).highestIntensity<float name='customColor.highestIntensity'>25</value>
Set adaption time of the eye in seconds.
customColor.adaptionTime or customColor({id}).adaptionTime<float name='customColor.adaptionTime'>25</value>
Set enable global illumination (GI) if supported.
customColor.enableGI or customColor({id}).enableGI<float name='customColor.enableGI'>false</value>
Set path to camera parameters file (*.decamera) to use. If not empty path the settings override the manual settings.
customColor.pathParameters or customColor({id}).pathParameters<string name='customColor.pathParameters'>default.decamera</string>
This behavior has no events.
This behavior requires no other behaviors.
This behavior supports these optional behaviors:
This behavior does require the element class to be persistable (setPersistable).
Since DragonScript Module Version 1.0
This example defines an element which contain a camera.
class MyElement extends BehaviorElementClass
public var ECBehaviorCollider collider
public var ECBehaviorCamera camera
public func new()
collider = ECBehaviorCollider.new(this)
camera = ECBehaviorCamera.new(this, collider)
camera.getAttach().getPosition().setVector(Vector.new(0, 0, 0.1))
camera.getViewDistance().setValue(300)
camera.getPathParameters().setValue("/content/cameras/scope.decamera")
end
end
Using element class supporting adding behaviors the behavior can be added like this:
<?xml version='1.0' encoding='UTF-8'?> <elementClass name='MyClass' class='GenericBehaviorElement'> <behavior type='ECBehaviorCamera'> <!-- optional: set layer mask (default empty). list of bits to set. --> <string name='layerMask'>0 1 4</string> <!-- set element properties. omit property prefix if used inside behavior tag --> <float name='.viewDistance'>300</float> </behavior> <!-- for adding multiple behaviors use unique identifiers --> <behavior type='ECBehaviorCamera' id='second'> ... </behavior> </elementClass>