Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


distanceScale

The scale applied to the calculated distance between source and target.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.Physics2DModule
public float distanceScale { get; set; }

Remarks

When the distance is calculated between source and target for distance-based force calculations (such as inverse-linear or inverse-squared), it is then scaled by this value. This changes the effective distance used, it does not change the actual distance in which the effector works, as that is always controlled by the collider.
This can be useful when using very large or very small colliders, allowing you to shrink or expand the distance calculation, changing the magnitude of the force applied.