All Questions

Community

S
Brody Schulke

Why when in the Idle state, and the platform moves from underneath, do we not transition to the air state?

Why doesn't the following code transition the player to the air state when the platform moves from underneath the character (before the move and slide with snap fix)?

elif not owner.is_on_floor():

_state_machine.transition_to("Move/Air")


  • Nathan Lovato replied

    It's because to detect that a body is on the floor, the physics engine needs the body itself to move and collide with it. A kinematic body is considered on the floor if it moved and collided with a floor that frame. Same from is_on_wall(), but with walls.