Class ConstraintTarget
- Namespace
- WitShells.AnimationRig
Represents a single constraint target that can be assigned to follow a source transform. Provides fine-grained control over position and rotation constraints.
[Serializable]
public class ConstraintTarget
- Inheritance
-
ConstraintTarget
- Inherited Members
Properties
ConstrainPosition
public bool ConstrainPosition { get; set; }
Property Value
ConstrainRotation
public bool ConstrainRotation { get; set; }
Property Value
IsValid
public bool IsValid { get; }
Property Value
PositionOffset
public Vector3 PositionOffset { get; set; }
Property Value
- Vector3
RotationOffset
public Vector3 RotationOffset { get; set; }
Property Value
- Vector3
Source
public Transform Source { get; set; }
Property Value
- Transform
Target
public Transform Target { get; set; }
Property Value
- Transform
Weight
public float Weight { get; set; }
Property Value
Methods
CreateFullConstraint(Transform, Transform)
Creates a full position and rotation constraint.
public static ConstraintTarget CreateFullConstraint(Transform target, Transform source)
Parameters
targetTransformsourceTransform
Returns
CreatePositionConstraint(Transform, Transform, Vector3)
Creates a position-only constraint.
public static ConstraintTarget CreatePositionConstraint(Transform target, Transform source, Vector3 offset = null)
Parameters
targetTransformsourceTransformoffsetVector3
Returns
CreateRotationConstraint(Transform, Transform, Vector3)
Creates a rotation-only constraint.
public static ConstraintTarget CreateRotationConstraint(Transform target, Transform source, Vector3 offset = null)
Parameters
targetTransformsourceTransformoffsetVector3
Returns
Reset()
Resets the constraint to default state.
public void Reset()
Snap()
Instantly snaps the target to the source position/rotation.
public void Snap()
UpdateConstraint(float)
Updates the constraint target to follow the source. Call this in Update or LateUpdate.
public void UpdateConstraint(float deltaTime)
Parameters
deltaTimefloat