Skip to content

CVR Distance Constrain

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

NameTypeDescription
targetTransformThe target transform to measure distance from.
minDistancefloatThe minimum distance the object must stay from the target.
maxDistancefloatThe 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