LookAtModifier3D
The LookAtModifier3D rotates a bone to look at a target.
The LookAtModifier3D rotates a bone to look at a target.
This SkeletonModifier3D rotates a bone to look at a target. This is helpful for moving a character's head to look at the player, rotating a turret to look at a target, or any other case where you want to make a bone rotate towards something quickly and easily.
When applying multiple LookAtModifier3Ds, the LookAtModifier3D assigned to the parent bone must be put above the LookAtModifier3D assigned to the child bone in the list in order for the child bone results to be correct.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
LookAtModifier3DConstructor
public LookAtModifier3D();Properties31
BoneProperty
public int Bone { get; set; }Index of the LookAtModifier3D.BoneName in the parent Skeleton3D.
BoneNameProperty
public string BoneName { get; set; }The bone name of the Skeleton3D that the modification will operate on.
DurationProperty
public float Duration { get; set; }The duration of the time-based interpolation. Interpolation is triggered at the following cases:
- When the target node is changed
- When an axis is flipped due to angle limitation
Note: The flipping occurs when the target is outside the angle limitation and the internally computed secondary rotation axis of the forward vector is flipped. Visually, it occurs when the target is outside the angle limitation and crosses the plane of the
LookAtModifier3D.ForwardAxisandLookAtModifier3D.PrimaryRotationAxis.
EaseTypeProperty
public Tween.EaseType EaseType { get; set; }The ease type of the time-based interpolation. See also Tween.EaseType.
ForwardAxisProperty
public SkeletonModifier3D.BoneAxis ForwardAxis { get; set; }The forward axis of the bone. This SkeletonModifier3D modifies the bone so that this axis points toward the target_node.
OriginBoneProperty
public int OriginBone { get; set; }Index of the LookAtModifier3D.OriginBoneName in the parent Skeleton3D.
OriginBoneNameProperty
public string OriginBoneName { get; set; }If LookAtModifier3D.OriginFrom is LookAtModifier3D.OriginFromEnum.SpecificBone, the bone global pose position specified for this is used as origin.
OriginExternalEntityProperty
public EntityPath OriginExternalEntity { get; set; }If LookAtModifier3D.OriginFrom is LookAtModifier3D.OriginFromEnum.ExternalNode, the global position of the Entity3D specified for this is used as origin.
OriginFromProperty
public LookAtModifier3D.OriginFromEnum OriginFrom { get; set; }This value determines from what origin is retrieved for use in the calculation of the forward vector.
OriginOffsetProperty
public Vector3 OriginOffset { get; set; }The offset of the bone pose origin. Matching the origins by offset is useful for cases where multiple bones must always face the same direction, such as the eyes.
Note: This value indicates the local position of the object set in LookAtModifier3D.OriginFrom.
OriginSafeMarginProperty
public float OriginSafeMargin { get; set; }If the target passes through too close to the origin than this value, time-based interpolation is used even if the target is within the angular limitations, to prevent the angular velocity from becoming too high.
PrimaryDampThresholdProperty
public float PrimaryDampThreshold { get; set; }The threshold to start damping for LookAtModifier3D.PrimaryLimitAngle. It provides non-linear (b-spline) interpolation, let it feel more resistance the more it rotate to the edge limit. This is useful for simulating the limits of human motion.
If 1.0, no damping is performed. If 0.0, damping is always performed.
PrimaryLimitAngleProperty
public float PrimaryLimitAngle { get; set; }The limit angle of the primary rotation when LookAtModifier3D.SymmetryLimitation is true, in radians.
PrimaryNegativeDampThresholdProperty
public float PrimaryNegativeDampThreshold { get; set; }The threshold to start damping for LookAtModifier3D.PrimaryNegativeLimitAngle.
PrimaryNegativeLimitAngleProperty
public float PrimaryNegativeLimitAngle { get; set; }The limit angle of negative side of the primary rotation when LookAtModifier3D.SymmetryLimitation is false, in radians.
PrimaryPositiveDampThresholdProperty
public float PrimaryPositiveDampThreshold { get; set; }The threshold to start damping for LookAtModifier3D.PrimaryPositiveLimitAngle.
PrimaryPositiveLimitAngleProperty
public float PrimaryPositiveLimitAngle { get; set; }The limit angle of positive side of the primary rotation when LookAtModifier3D.SymmetryLimitation is false, in radians.
PrimaryRotationAxisProperty
public Vector3.Axis PrimaryRotationAxis { get; set; }The axis of the first rotation. This SkeletonModifier3D works by compositing the rotation by Euler angles to prevent to rotate the LookAtModifier3D.ForwardAxis.
Note: Since LookAtModifier3D never modifies the twist when LookAtModifier3D.UseSecondaryRotation is false and LookAtModifier3D.Relative is true, the twist is not fixed even if LookAtModifier3D.UseRestForLimitation is true.
RelativeProperty
public bool Relative { get; set; }The relative option. If true, the rotation is applied relative to the pose. If false, the rotation is applied relative to the rest. It means to replace the current pose with the LookAtModifier3D's result.
SecondaryDampThresholdProperty
public float SecondaryDampThreshold { get; set; }The threshold to start damping for LookAtModifier3D.SecondaryLimitAngle.
SecondaryLimitAngleProperty
public float SecondaryLimitAngle { get; set; }The limit angle of the secondary rotation when LookAtModifier3D.SymmetryLimitation is true, in radians.
SecondaryNegativeDampThresholdProperty
public float SecondaryNegativeDampThreshold { get; set; }The threshold to start damping for LookAtModifier3D.SecondaryNegativeLimitAngle.
SecondaryNegativeLimitAngleProperty
public float SecondaryNegativeLimitAngle { get; set; }The limit angle of negative side of the secondary rotation when LookAtModifier3D.SymmetryLimitation is false, in radians.
SecondaryPositiveDampThresholdProperty
public float SecondaryPositiveDampThreshold { get; set; }The threshold to start damping for LookAtModifier3D.SecondaryPositiveLimitAngle.
SecondaryPositiveLimitAngleProperty
public float SecondaryPositiveLimitAngle { get; set; }The limit angle of positive side of the secondary rotation when LookAtModifier3D.SymmetryLimitation is false, in radians.
SymmetryLimitationProperty
public bool SymmetryLimitation { get; set; }If true, the limitations are spread from the bone symmetrically.
If false, the limitation can be specified separately for each side of the reference pose. In here, the reference pose is the bone pose immediately before processing this modifier.
TargetEntityProperty
public EntityPath TargetEntity { get; set; }The EntityPath to the node that is the target for the look at modification. This node is what the modification will rotate the bone to.
TransitionTypeProperty
public Tween.TransitionType TransitionType { get; set; }The transition type of the time-based interpolation. See also Tween.TransitionType.
UseAngleLimitationProperty
public bool UseAngleLimitation { get; set; }If true, limits the amount of rotation. For example, this helps to prevent a character's neck from rotating 360 degrees.
Note: As with AnimationTree blending, interpolation is provided that favors Skeleton3D.GetBoneRest or Skeleton3D.GetBonePose depends on the LookAtModifier3D.Relative option. This means that interpolation does not select the shortest path in some cases.
Note: Some values for LookAtModifier3D.TransitionType (such as Tween.TransitionType.Back, Tween.TransitionType.Elastic, and Tween.TransitionType.Spring) may exceed the limitations. If interpolation occurs while overshooting the limitations, the result might not respect the bone rest.
UseRestForLimitationProperty
public bool UseRestForLimitation { get; set; }If true, the angle limitation and the rotation axes are applied based on the Skeleton3D.GetBoneRest.
If false, the angle limitation is applied based on the reference pose. In here, the reference pose is the bone pose immediately before processing this modifier.
Note: The limitation is applied to the rotation computed by this modifier. If the reference pose is rotated around the same axis, the limitation behaves as if it also limits the rotation of the reference pose. A rotation that this modifier does not change, such as the twist, is not limited.
UseSecondaryRotationProperty
public bool UseSecondaryRotation { get; set; }If true, provides rotation by two axes.
Methods65
GetBoneint
public int GetBone();intGetBoneNamestring
public string GetBoneName();stringGetDurationfloat
public float GetDuration();floatGetEaseTypeTween.EaseType
public Tween.EaseType GetEaseType();Tween.EaseTypeGetForwardAxisSkeletonModifier3D.BoneAxis
public SkeletonModifier3D.BoneAxis GetForwardAxis();SkeletonModifier3D.BoneAxisGetInterpolationRemainingfloat
public float GetInterpolationRemaining();Returns the remaining seconds of the time-based interpolation.
floatGetOriginBoneint
public int GetOriginBone();intGetOriginBoneNamestring
public string GetOriginBoneName();stringGetOriginExternalEntityEntityPath
public EntityPath GetOriginExternalEntity();EntityPathGetOriginFromLookAtModifier3D.OriginFromEnum
public LookAtModifier3D.OriginFromEnum GetOriginFrom();LookAtModifier3D.OriginFromEnumGetOriginOffsetVector3
public Vector3 GetOriginOffset();Vector3GetOriginSafeMarginfloat
public float GetOriginSafeMargin();floatGetPrimaryDampThresholdfloat
public float GetPrimaryDampThreshold();floatGetPrimaryLimitAnglefloat
public float GetPrimaryLimitAngle();floatGetPrimaryNegativeDampThresholdfloat
public float GetPrimaryNegativeDampThreshold();floatGetPrimaryNegativeLimitAnglefloat
public float GetPrimaryNegativeLimitAngle();floatGetPrimaryPositiveDampThresholdfloat
public float GetPrimaryPositiveDampThreshold();floatGetPrimaryPositiveLimitAnglefloat
public float GetPrimaryPositiveLimitAngle();floatGetPrimaryRotationAxisVector3.Axis
public Vector3.Axis GetPrimaryRotationAxis();Vector3.AxisGetSecondaryDampThresholdfloat
public float GetSecondaryDampThreshold();floatGetSecondaryLimitAnglefloat
public float GetSecondaryLimitAngle();floatGetSecondaryNegativeDampThresholdfloat
public float GetSecondaryNegativeDampThreshold();floatGetSecondaryNegativeLimitAnglefloat
public float GetSecondaryNegativeLimitAngle();floatGetSecondaryPositiveDampThresholdfloat
public float GetSecondaryPositiveDampThreshold();floatGetSecondaryPositiveLimitAnglefloat
public float GetSecondaryPositiveLimitAngle();floatGetTargetEntityEntityPath
public EntityPath GetTargetEntity();EntityPathGetTransitionTypeTween.TransitionType
public Tween.TransitionType GetTransitionType();Tween.TransitionTypeIsInterpolatingbool
public bool IsInterpolating();Returns true if time-based interpolation is running. If false, it is equivalent to LookAtModifier3D.GetInterpolationRemaining returning 0.0.
This is useful to determine whether a LookAtModifier3D can be removed safely.
boolIsLimitationSymmetrybool
public bool IsLimitationSymmetry();boolIsRelativebool
public bool IsRelative();boolIsTargetWithinLimitationbool
public bool IsTargetWithinLimitation();Returns whether the target is within the angle limitations. It is useful for unsetting the target_node when the target is outside of the angle limitations.
Note: The value is updated after SkeletonModifier3D._ProcessModification. To retrieve this value correctly, we recommend using the signal SkeletonModifier3D.ModificationProcessed.
boolIsUsingAngleLimitationbool
public bool IsUsingAngleLimitation();boolIsUsingRestForLimitationbool
public bool IsUsingRestForLimitation();boolIsUsingSecondaryRotationbool
public bool IsUsingSecondaryRotation();boolSetBonevoid
public void SetBone(int bone);| Name | Type | Default |
|---|---|---|
bone | int | — |
SetBoneNamevoid
public void SetBoneName(string boneName);| Name | Type | Default |
|---|---|---|
boneName | string | — |
SetDurationvoid
public void SetDuration(float duration);| Name | Type | Default |
|---|---|---|
duration | float | — |
SetEaseTypevoid
public void SetEaseType(Tween.EaseType easeType);| Name | Type | Default |
|---|---|---|
easeType | Tween.EaseType | — |
SetForwardAxisvoid
public void SetForwardAxis(SkeletonModifier3D.BoneAxis forwardAxis);| Name | Type | Default |
|---|---|---|
forwardAxis | SkeletonModifier3D.BoneAxis | — |
SetOriginBonevoid
public void SetOriginBone(int bone);| Name | Type | Default |
|---|---|---|
bone | int | — |
SetOriginBoneNamevoid
public void SetOriginBoneName(string boneName);| Name | Type | Default |
|---|---|---|
boneName | string | — |
SetOriginExternalEntityvoid
public void SetOriginExternalEntity(EntityPath externalNode);| Name | Type | Default |
|---|---|---|
externalNode | EntityPath | — |
SetOriginFromvoid
public void SetOriginFrom(LookAtModifier3D.OriginFromEnum originFrom);| Name | Type | Default |
|---|---|---|
originFrom | LookAtModifier3D.OriginFromEnum | — |
SetOriginOffsetvoid
public void SetOriginOffset(Vector3 offset);| Name | Type | Default |
|---|---|---|
offset | Vector3 | — |
SetOriginSafeMarginvoid
public void SetOriginSafeMargin(float margin);| Name | Type | Default |
|---|---|---|
margin | float | — |
SetPrimaryDampThresholdvoid
public void SetPrimaryDampThreshold(float power);| Name | Type | Default |
|---|---|---|
power | float | — |
SetPrimaryLimitAnglevoid
public void SetPrimaryLimitAngle(float angle);| Name | Type | Default |
|---|---|---|
angle | float | — |
SetPrimaryNegativeDampThresholdvoid
public void SetPrimaryNegativeDampThreshold(float power);| Name | Type | Default |
|---|---|---|
power | float | — |
SetPrimaryNegativeLimitAnglevoid
public void SetPrimaryNegativeLimitAngle(float angle);| Name | Type | Default |
|---|---|---|
angle | float | — |
SetPrimaryPositiveDampThresholdvoid
public void SetPrimaryPositiveDampThreshold(float power);| Name | Type | Default |
|---|---|---|
power | float | — |
SetPrimaryPositiveLimitAnglevoid
public void SetPrimaryPositiveLimitAngle(float angle);| Name | Type | Default |
|---|---|---|
angle | float | — |
SetPrimaryRotationAxisvoid
public void SetPrimaryRotationAxis(Vector3.Axis axis);| Name | Type | Default |
|---|---|---|
axis | Vector3.Axis | — |
SetRelativevoid
public void SetRelative(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
SetSecondaryDampThresholdvoid
public void SetSecondaryDampThreshold(float power);| Name | Type | Default |
|---|---|---|
power | float | — |
SetSecondaryLimitAnglevoid
public void SetSecondaryLimitAngle(float angle);| Name | Type | Default |
|---|---|---|
angle | float | — |
SetSecondaryNegativeDampThresholdvoid
public void SetSecondaryNegativeDampThreshold(float power);| Name | Type | Default |
|---|---|---|
power | float | — |
SetSecondaryNegativeLimitAnglevoid
public void SetSecondaryNegativeLimitAngle(float angle);| Name | Type | Default |
|---|---|---|
angle | float | — |
SetSecondaryPositiveDampThresholdvoid
public void SetSecondaryPositiveDampThreshold(float power);| Name | Type | Default |
|---|---|---|
power | float | — |
SetSecondaryPositiveLimitAnglevoid
public void SetSecondaryPositiveLimitAngle(float angle);| Name | Type | Default |
|---|---|---|
angle | float | — |
SetSymmetryLimitationvoid
public void SetSymmetryLimitation(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
SetTargetEntityvoid
public void SetTargetEntity(EntityPath targetEntity);| Name | Type | Default |
|---|---|---|
targetEntity | EntityPath | — |
SetTransitionTypevoid
public void SetTransitionType(Tween.TransitionType transitionType);| Name | Type | Default |
|---|---|---|
transitionType | Tween.TransitionType | — |
SetUseAngleLimitationvoid
public void SetUseAngleLimitation(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
SetUseRestForLimitationvoid
public void SetUseRestForLimitation(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
SetUseSecondaryRotationvoid
public void SetUseSecondaryRotation(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
LookAtModifier3D.OriginFromEnum
| Value | Description |
|---|---|
ExternalNode = 2 | The global position of the |
Self = 0 | The bone rest position of the bone specified in |
SpecificBone = 1 | The bone global pose position of the bone specified in |