Click or drag to resize

KinematicBody2DCollision__safeMargin Property

Extra margin used for collision recovery in motion functions (see MoveAndCollide(Vector2, Boolean, Boolean, Boolean), MoveAndSlide(Vector2, NullableVector2, Boolean, Int32, Single, Boolean), MoveAndSlideWithSnap(Vector2, Vector2, NullableVector2, Boolean, Int32, Single, Boolean)).

If the body is at least this close to another body, it will consider them to be colliding and will be pushed away before performing the actual motion.

A higher value means it's more flexible for detecting collision, which helps with consistently detecting walls and floors.

A lower value forces the collision algorithm to use more exact detection, so it can be used in cases that specifically require precision, e.g at very low scale to avoid visible jittering, or for stability with a stack of kinematic bodies.

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
public float Collision__safeMargin { get; set; }

Property Value

Type: Single
See Also