safeMargin

    Extra margin used for collision recovery when calling moveAndSlide.

    CharacterBody2D.swift:239
    final var safeMargin: Double { get set }

    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 character bodies.

    Other members in extension

    Types

    Type members

    Instance members