Drag[en]gine Script Module DragonScript  1.23
Dragengine.Scenery.ECBehaviorActorIK Class Reference

Behavior adding inverse kinematic support to actors. More...

Inheritance diagram for Dragengine.Scenery.ECBehaviorActorIK:
Dragengine.Scenery.DefaultECBehavior Dragengine.Scenery.ECBehavior Dragengine.Scenery.BehaviorCompatiblePersistency

Classes

class  Instance
 Behavior instance. More...
 

Public Member Functions

void dispose ()
 Dispose of behavior. More...
 
ECBehaviorActorAnimated getActorAnimated ()
 Actor animated behavior. More...
 
ECPString getControllerIKAzimuth ()
 IK Azimuth Controller name. More...
 
ECPString getControllerIKDistance ()
 IK Distance Controller name. More...
 
ECPString getControllerIKElevation ()
 IK Elevation Controller name. More...
 
ECPString getControllerIKHeight ()
 IK Height Controller name. More...
 
ECPString getControllerIKPan ()
 IK Pan Controller name. More...
 
ECPString getControllerIKPosition ()
 IK Position Controller name. More...
 
ECPString getControllerIKRotation ()
 IK Rotation Controller name. More...
 
Instance instance (BehaviorElement element)
 Get instance in element from owner element class. More...
 
ECBehaviorActorIK new (BehaviorElementClass eclass, ECBehaviorActorAnimated actorAnimated)
 Create behavior element class. More...
 
ECBehaviorActorIK new (BehaviorElementClass eclass, ECBehaviorActorAnimated actorAnimated, String id)
 
ECBehaviorActorIK new (BehaviorElementClass eclass, ECBehaviorActorAnimated actorAnimated, String id, String subId)
 
ECBehaviorActorIK new (BehaviorElementClass eclass, ECBehaviorActorAnimated actorAnimated, String id, String subId, String prefix)
 
- Public Member Functions inherited from Dragengine.Scenery.DefaultECBehavior
void assignInstanceIndex (int instanceIndex)
 Assign instance index. More...
 
String getBehaviorID ()
 Unique identifier of behavior. More...
 
String getID ()
 Identifier. More...
 
int getInstanceIndex ()
 Instance index. More...
 
void loadSupportedData (String identifier, PersistencyEnvironment env, FileReader reader, ECBehaviorInstance instance)
 Load instance data of another behavior. More...
 
bool supportsBehaviorID (String identifier)
 Behavior supports loading instance data of another behavior. More...
 
- Public Member Functions inherited from Dragengine.Scenery.ECBehavior
ECBehaviorInstance createInstance (BehaviorElement element)
 Create Behavior instance. More...
 

Static Public Member Functions

static ECBehaviorActorIK getBehaviorIn (BehaviorElementClass eclass)
 Get behavior in element class or null if absent. More...
 

Public Attributes

ECBehaviorActorAnimated pActorAnimated
 
ECPString pControllerIKAzimuth
 
ECPString pControllerIKDistance
 
ECPString pControllerIKElevation
 
ECPString pControllerIKHeight
 
ECPString pControllerIKPan
 
ECPString pControllerIKPosition
 
ECPString pControllerIKRotation
 

Additional Inherited Members

- Protected Member Functions inherited from Dragengine.Scenery.DefaultECBehavior
DefaultECBehavior new (BehaviorElementClass eclass)
 Create default composeable behavior with empty identifier. More...
 
DefaultECBehavior new (BehaviorElementClass eclass, String id)
 Create default composeable behavior. More...
 
void setBehaviorID (String identifier)
 Set behavior identifier. More...
 
void useClassNameAsBehaviorID ()
 Set behavior identifier to "<class-name>:<identifier>". More...
 
void useFullyQualifiedClassNameAsBehaviorID ()
 Set behavior identifier to "<fully-qualified-class-name>:<identifier>". More...
 

Detailed Description

Behavior adding inverse kinematic support to actors.

IK is typically used for situations where actors touch specific points on an object while interacting with them and the exact position or orientation is not well defined. This can be used for example if the actor pulls a lever but the lever can be on different heights above the ground. Using the IK behavior this can be solved without duplicating coding.

To use this behavior add it to the element class after ECBehaviorActorAnimated. By default the behavior is disabled. To use IK enable/disable the behavior from the actor action at the appropriate time. Once enabled the behavior tries to find in ECBehaviorActorAnimated the animator controllers to input the IK parameters. All controllers are optional and will be updated only if present. Assign to the behavior the target position to track. The behavior actively tracks the element each frame update so dynamic targets are possible. The target is defined using an Element instance with optional local matrix and bone name. Bone name is supported if target is castable to BehaviorElement and supports ECBehaviorComponent.

The behavior supports 3 controllers to input IK information to the animator.

The IK Position Controller is used to set position of the target relative to the component assigned to the animator. The position is assigned as "vector value".

The IK Rotation Controller is used to set orientation of the target relative to the component assigned to the animator. The orientation is assigned as "vector value".

The IK Height Controller is used to set the height of the target above the ground. This is the same value as "position.getY()" but assigned as single "value". This controller allows to fine tune animators to different target heights above ground. To get the best results you usually have to use an animation for reaching at objects in upright and crouched position. Using this controller you can blend between such animations (typically a group rule with selector link).

The Pan Controller is used to set the horizontal panning of the target. This is the same value as "position.getX()" but assigned as a single "value". This controller allows to fine tune animators to different horizontal distances along a wall. To get the best results you usually have to use an animation for reaching at objects at the far left and right position on the wall. Using this controller you can blend betwen such animations (typically a group rule with selector link).

The Distance Controller is used to set the distance of the target. This is the same value as "position.getZ()" but assigned as a single "value". This controller allows to fine tune animators to different distances in front of the actor. To get the best results you usually have to use an animation for reaching at objects at far and close distance in front of the actor. Using this controller you can blend betwen such animations (typically a group rule with selector link).

The Azimuth Controller is used to set the location of the target relative to the actor expressed as angle. This is the same value as "DEMath.atan2(-position.getX(), position.getZ())" but assigned as a single "value". The value has a range from -180 to 180 with positive values located on the left side of the actor. This controller allows to fine tune animators to different locations around the actor. It is possible to simulate this angle in an animator by using a properly shaped link curve on the pan or distance controller. Using the azimuth controller though is simpler and leaves the link curve shape open for fine control. To get the best results you usually have to use an animation for reaching at objects at the front, left and right side of the actor and optionally at the back side. Using this controller you can blend betwen such animations (typically a group rule with selector link).

The Elevation Controller is used to set the location of the target relative to the actor expressed as angle. This is the same value as "DEMath.atan2(position.getY(), position.getZ())" but assigned as a single "value". The value has a range from -90 to 90 with positive values located upwards. This controller allows to fine tune animators to different locations around the actor. It is possible to simulate this angle in an animator by using a properly shaped link curve on the pan or distance controller. Using the elevation controller though is simpler and leaves the link curve shape open for fine control. To get the best results you usually have to use an animation for reaching at objects at the up, level and down position. Using this controller you can blend betwen such animations (typically a group rule with selector link).

For the azimuth and elevation controller a reference matrix can be set. This indicates the coordinate system to use in the actor to calculate these values. By default this is the identity matrix locating the coordinate system at the feet of the actor pointing in the same direction as the actor. For using azimuth and elevation you usually have to set the reference matrix near the shoulders to get meaningful values. If a reference bone is set the reference matrix is relative to this bone.

Behavior can be added multiple times allowing to handle multiple IK targets per actor.

Element class property prefix is "actorIK" or "actorIK(id)".

These element class properties are supported:

  • actorIK{(id)}.controllerIKPosition : ECBString. Name of IK Position Controller
  • actorIK{(id)}.controllerIKRotation : ECBString. Name of IK Rotation Controller
  • actorIK{(id)}.controllerIKHeight : ECBString. Name of IK Height Controller
  • actorIK{(id)}.controllerIKPan: ECBString. Name of IK Pan Controller
  • actorIK{(id)}.controllerIKDistance: ECBString. Name of IK Distance Controller
  • actorIK{(id)}.controllerIKAzimuth: ECBString. Name of IK Azimuth Controller
  • actorIK{(id)}.controllerIKElevation: ECBString. Name of IK Elevation Controller

Member Function Documentation

◆ dispose()

void Dragengine.Scenery.ECBehaviorActorIK.dispose ( )

Dispose of behavior.

Reimplemented from Dragengine.Scenery.DefaultECBehavior.

◆ getActorAnimated()

ECBehaviorActorAnimated Dragengine.Scenery.ECBehaviorActorIK.getActorAnimated ( )

Actor animated behavior.

◆ getBehaviorIn()

static ECBehaviorActorIK Dragengine.Scenery.ECBehaviorActorIK.getBehaviorIn ( BehaviorElementClass  eclass)
static

Get behavior in element class or null if absent.

Use this method to check if a particular BehaviorElementClass contains a behavior of type ECBehaviorComponent.

◆ getControllerIKAzimuth()

ECPString Dragengine.Scenery.ECBehaviorActorIK.getControllerIKAzimuth ( )

IK Azimuth Controller name.

Version
1.21

◆ getControllerIKDistance()

ECPString Dragengine.Scenery.ECBehaviorActorIK.getControllerIKDistance ( )

IK Distance Controller name.

Version
1.21

◆ getControllerIKElevation()

ECPString Dragengine.Scenery.ECBehaviorActorIK.getControllerIKElevation ( )

IK Elevation Controller name.

Version
1.21

◆ getControllerIKHeight()

ECPString Dragengine.Scenery.ECBehaviorActorIK.getControllerIKHeight ( )

IK Height Controller name.

◆ getControllerIKPan()

ECPString Dragengine.Scenery.ECBehaviorActorIK.getControllerIKPan ( )

IK Pan Controller name.

Version
1.21

◆ getControllerIKPosition()

ECPString Dragengine.Scenery.ECBehaviorActorIK.getControllerIKPosition ( )

IK Position Controller name.

◆ getControllerIKRotation()

ECPString Dragengine.Scenery.ECBehaviorActorIK.getControllerIKRotation ( )

IK Rotation Controller name.

◆ instance()

Instance Dragengine.Scenery.ECBehaviorActorIK.instance ( BehaviorElement  element)

Get instance in element from owner element class.

◆ new() [1/4]

ECBehaviorActorIK Dragengine.Scenery.ECBehaviorActorIK.new ( BehaviorElementClass  eclass,
ECBehaviorActorAnimated  actorAnimated 
)

Create behavior element class.

◆ new() [2/4]

ECBehaviorActorIK Dragengine.Scenery.ECBehaviorActorIK.new ( BehaviorElementClass  eclass,
ECBehaviorActorAnimated  actorAnimated,
String  id 
)

◆ new() [3/4]

ECBehaviorActorIK Dragengine.Scenery.ECBehaviorActorIK.new ( BehaviorElementClass  eclass,
ECBehaviorActorAnimated  actorAnimated,
String  id,
String  subId 
)

◆ new() [4/4]

ECBehaviorActorIK Dragengine.Scenery.ECBehaviorActorIK.new ( BehaviorElementClass  eclass,
ECBehaviorActorAnimated  actorAnimated,
String  id,
String  subId,
String  prefix 
)

Member Data Documentation

◆ pActorAnimated

ECBehaviorActorAnimated Dragengine.Scenery.ECBehaviorActorIK.pActorAnimated

◆ pControllerIKAzimuth

ECPString Dragengine.Scenery.ECBehaviorActorIK.pControllerIKAzimuth

◆ pControllerIKDistance

ECPString Dragengine.Scenery.ECBehaviorActorIK.pControllerIKDistance

◆ pControllerIKElevation

ECPString Dragengine.Scenery.ECBehaviorActorIK.pControllerIKElevation

◆ pControllerIKHeight

ECPString Dragengine.Scenery.ECBehaviorActorIK.pControllerIKHeight

◆ pControllerIKPan

ECPString Dragengine.Scenery.ECBehaviorActorIK.pControllerIKPan

◆ pControllerIKPosition

ECPString Dragengine.Scenery.ECBehaviorActorIK.pControllerIKPosition

◆ pControllerIKRotation

ECPString Dragengine.Scenery.ECBehaviorActorIK.pControllerIKRotation

The documentation for this class was generated from the following file: