Skip to content

CVR Distance Constrain

Constrains the position of an object relative to a target transform within a minimum and maximum distance range.

| Name | Type | Description | |---------------|------------|------------------------------------------------------------| | target | Transform| The target transform to measure distance from. | | minDistance | float | The minimum distance the object must stay from the target. | | maxDistance | float | The maximum distance the object can be from the target. |

  • If minDistance or maxDistance is 0, that bound is treated as unbounded (only the other bound is enforced).
  • Gizmos are drawn in the Scene View to visualize the constrained range when the component is selected.
  • Distance constraints are applied during both Update and LateUpdate, so animations and post-animation transform changes are both clamped.
  • CVR-GameFiles/ABI.CCK.Components/CVRDistanceConstrain.cs