Version: 2023.1
LanguageEnglish
  • C#

Rigidbody2D.SlideMovement.surfaceAnchor

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public Vector2 surfaceAnchor;

Description

The direction and distance to use when detecting if a surface is nearby during a slide iteration.

During a Rigiodbody2D.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.

See Also: Rigidbody2D.Slide and SlideResults.