Table of Contents

,

Start Page » DragonScript Scripting Language » Abstraction Layers: How you want to build your Game » Behavior Elements » ECBehaviorCamera

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:

Instance Counts

This behavior can be added multiple times to an element. Use the behavior identifier to tell them apart.

Element Class Properties

Element class properties have the prefix camera. or camera({id}). if id is not empty.

position

Set position to attach resource to collider.

orientation

Set orientation to attach resource to collider in degrees.

bone

Set bone to attach resource to. If empty string attach to collider.

fov

Set vertical field of view in degrees for the entire view.

fovRatio

Set aspect ratio of the horizontal field of view to the vertical field of view.

imageDistance

Set distance to the image plane.

viewDistance

Set viewing distance up to which world geometry is rendered.

enableHDRR

Set enable high definition range rendering (HDRR) if supported.

exposure

Set exposure.

lowestIntensity

Set lowest intensity the eye can adapt to.

highestIntensity

Set highest intensity the eye can adapt to.

adaptionTime

Set adaption time of the eye in seconds.

enableGI

Set enable global illumination (GI) if supported.

pathParameters

Set path to camera parameters file (*.decamera) to use. If not empty path the settings override the manual settings.

Events

This behavior has no events.

Required Behaviors

This behavior requires no other behaviors.

Optional Behaviors

Persistency

This behavior does require the element class to be persistable (setPersistable).

API Documentation

ECBehaviorCamera.

Since DragonScript Module Version 1.0

Use Cases

Element Class Example

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

Behavior Factory

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>

Live Examples