Table of Contents

Class ConstraintTarget

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

bool

ConstrainRotation

public bool ConstrainRotation { get; set; }

Property Value

bool

IsValid

public bool IsValid { get; }

Property Value

bool

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

float

Methods

CreateFullConstraint(Transform, Transform)

Creates a full position and rotation constraint.

public static ConstraintTarget CreateFullConstraint(Transform target, Transform source)

Parameters

target Transform
source Transform

Returns

ConstraintTarget

CreatePositionConstraint(Transform, Transform, Vector3)

Creates a position-only constraint.

public static ConstraintTarget CreatePositionConstraint(Transform target, Transform source, Vector3 offset = null)

Parameters

target Transform
source Transform
offset Vector3

Returns

ConstraintTarget

CreateRotationConstraint(Transform, Transform, Vector3)

Creates a rotation-only constraint.

public static ConstraintTarget CreateRotationConstraint(Transform target, Transform source, Vector3 offset = null)

Parameters

target Transform
source Transform
offset Vector3

Returns

ConstraintTarget

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

deltaTime float