character_controller_offset
For performance and numerical stability reasons, the character controller will attempt to preserve a small gap between
the character shape and the environment. This small gap is named offset
and acts as a small margin around the character
shape. A good value for this offset is something sufficiently small to make the gap unnoticeable, but sufficiently large
to avoid numerical issues (if the character seems to get stuck inexplicably, try increasing the offset).
/* Configure the character controller when the collider is created. */
commands
.spawn(Collider::ball(0.5))
.insert(KinematicCharacterController {
// The character offset is set to 0.01.
offset: CharacterLength::Absolute(0.01),
..default()
});
commands
.spawn(Collider::ball(0.5))
.insert(KinematicCharacterController {
// The character offset is set to 0.01 multiplied by the collider’s height.
offset: CharacterLength::Relative(0.01),
..default()
});
warning
It is not recommended to change the offset after the creation of the character controller.