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.
See also:
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.
camera.fov
or camera({id}).fov
<float name='camera.fov'>60</value>
Set aspect ratio of the horizontal field of view to the vertical field of view.
camera.fovRatio
or camera({id}).fovRatio
<float name='camera.fovRatio'>1.5</value>
Set distance to the image plane.
camera.imageDistance
or camera({id}).imageDistance
<float name='camera.imageDistance'>0.1</value>
Set viewing distance up to which world geometry is rendered.
camera.viewDistance
or camera({id}).viewDistance
<float name='camera.viewDistance'>500</value>
Set enable high definition range rendering (HDRR) if supported.
camera.enableHDRR
or camera({id}).enableHDRR
<float name='camera.enableHDRR'>false</value>
Set exposure.
camera.exposure
or camera({id}).exposure
<float name='camera.exposure'>1.5</value>
Set lowest intensity the eye can adapt to.
camera.lowestIntensity
or camera({id}).lowestIntensity
<float name='camera.lowestIntensity'>10</value>
Set highest intensity the eye can adapt to.
camera.highestIntensity
or camera({id}).highestIntensity
<float name='camera.highestIntensity'>25</value>
Set adaption time of the eye in seconds.
camera.adaptionTime
or camera({id}).adaptionTime
<float name='camera.adaptionTime'>25</value>
Set enable global illumination (GI) if supported.
camera.enableGI
or camera({id}).enableGI
<float name='camera.enableGI'>false</value>
Set path to camera parameters file (*.decamera
) to use. If not empty path the settings override the manual settings.
camera.pathParameters
or camera({id}).pathParameters
<string name='camera.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>