surfaceAnchor
The direction and distance to use when detecting if a surface is nearby during a slide iteration.
Read time 1 minuteLast updated 17 days ago
Definition
- Type: Property
- Namespace: UnityEngine
- Assembly: UnityEngine.Physics2DModule
public Vector2 surfaceAnchor { readonly get; set; }
Remarks
During a Rigidbody2D.Slide this vector is used to detect if a surface is nearby and will cause the slide to be anchored in that direction to the surface.
The default is _down which is a typical direction and distance used in platformers however this can be reduced in distance so that the surface anchoring is more subtle. If the surface anchor is _zero then surface anchoring will be disabled.
Additional Resources: Rigidbody2D.Slide, Rigidbody2D.SlideResults