Drag[en]gine Script Module DragonScript
1.23
|
Behavior adding inverse kinematic support to actors. More...
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... | |
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... | |
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:
void Dragengine.Scenery.ECBehaviorActorIK.dispose | ( | ) |
Dispose of behavior.
Reimplemented from Dragengine.Scenery.DefaultECBehavior.
ECBehaviorActorAnimated Dragengine.Scenery.ECBehaviorActorIK.getActorAnimated | ( | ) |
Actor animated behavior.
|
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.
ECPString Dragengine.Scenery.ECBehaviorActorIK.getControllerIKAzimuth | ( | ) |
IK Azimuth Controller name.
ECPString Dragengine.Scenery.ECBehaviorActorIK.getControllerIKDistance | ( | ) |
IK Distance Controller name.
ECPString Dragengine.Scenery.ECBehaviorActorIK.getControllerIKElevation | ( | ) |
IK Elevation Controller name.
ECPString Dragengine.Scenery.ECBehaviorActorIK.getControllerIKHeight | ( | ) |
IK Height Controller name.
ECPString Dragengine.Scenery.ECBehaviorActorIK.getControllerIKPan | ( | ) |
IK Pan Controller name.
ECPString Dragengine.Scenery.ECBehaviorActorIK.getControllerIKPosition | ( | ) |
IK Position Controller name.
ECPString Dragengine.Scenery.ECBehaviorActorIK.getControllerIKRotation | ( | ) |
IK Rotation Controller name.
Instance Dragengine.Scenery.ECBehaviorActorIK.instance | ( | BehaviorElement | element | ) |
Get instance in element from owner element class.
ECBehaviorActorIK Dragengine.Scenery.ECBehaviorActorIK.new | ( | BehaviorElementClass | eclass, |
ECBehaviorActorAnimated | actorAnimated | ||
) |
Create behavior element class.
ECBehaviorActorIK Dragengine.Scenery.ECBehaviorActorIK.new | ( | BehaviorElementClass | eclass, |
ECBehaviorActorAnimated | actorAnimated, | ||
String | id | ||
) |
ECBehaviorActorIK Dragengine.Scenery.ECBehaviorActorIK.new | ( | BehaviorElementClass | eclass, |
ECBehaviorActorAnimated | actorAnimated, | ||
String | id, | ||
String | subId | ||
) |
ECBehaviorActorIK Dragengine.Scenery.ECBehaviorActorIK.new | ( | BehaviorElementClass | eclass, |
ECBehaviorActorAnimated | actorAnimated, | ||
String | id, | ||
String | subId, | ||
String | prefix | ||
) |
ECBehaviorActorAnimated Dragengine.Scenery.ECBehaviorActorIK.pActorAnimated |
ECPString Dragengine.Scenery.ECBehaviorActorIK.pControllerIKAzimuth |
ECPString Dragengine.Scenery.ECBehaviorActorIK.pControllerIKDistance |
ECPString Dragengine.Scenery.ECBehaviorActorIK.pControllerIKElevation |
ECPString Dragengine.Scenery.ECBehaviorActorIK.pControllerIKHeight |
ECPString Dragengine.Scenery.ECBehaviorActorIK.pControllerIKPan |
ECPString Dragengine.Scenery.ECBehaviorActorIK.pControllerIKPosition |
ECPString Dragengine.Scenery.ECBehaviorActorIK.pControllerIKRotation |