Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


surfaceAnchor

The direction and distance to use when detecting if a surface is nearby during a slide iteration.
Read time 1 minuteLast updated 10 days ago

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.Physics2DModule
public Vector2 surfaceAnchor { readonly get; set; }

Remarks

During a 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 Vector2.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 Vector2.zero then surface anchoring will be disabled.
Additional Resources: Rigidbody2D.Slide and Rigidbody2D.SlideResults.