Hi everyone,
I’m experimenting with the TopDownMovement behavior and noticed something odd when checking the player’s speed using Object.TopDownMovement::Speed().
The issue is that the speed value is not affected by collisions. For example:
- When the player sprite collides with a wall, visually it stops moving.
- But the TopDownMovement algorithm still reports a non‑zero speed.
- This causes problems for events that depend on speed (like triggering animations), because the engine thinks the player is still moving even though the sprite is stuck.
My temporary solution is:
- Force the velocity to
0on each axis when a collision is detected. - Add a small opposite impulse to the collision direction to avoid the “vibration” effect.
This works, but feels more like a hack than a clean solution.
Question: Is there a recommended way in GDevelop to make TopDownMovement::Speed() reflect the actual movement (considering collisions), or to synchronize animations with real movement instead of just the intended velocity?
Thanks in advance!