You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue description: building top down grid like movement game, move_and_slide/move_and_collide add erroneous position data so it moves out of being pixel perfect. So if x, y position vector of 32,24 would become 32.01216, 24.9389 if told to move_and_slide/move_and_collide.
Steps to reproduce: tiles are 16x16, CollisionShape Collision2D is 16x16, and using move_and_* means that the node has a float position, causing the collision shapes to meet, causing the movement to stop.
Minimal reproduction project:
For reference, here's the level:
This is the issue when move_and_* is called:
The position according to Godot remote:
My solution is to have a smaller collision shape and an additional test move_and_collide and if there is a collision then don't move, and have a final round() when the node stops moving, to snap it back to pixel position.
The text was updated successfully, but these errors were encountered:
Godot is inherently incapable of pixel perfect collision. If you want that, you'll need to write a physics engine based on Intergers and AABB tests exclusively.
So this isn't a bug, nor unexpected. You'll find this to be an issue with any Engine which does not feature a custom, pixel perfect, physics Engine.
I recommend you keep faking it. Like the entire rest of the games industry that rely on premade Engines.
*Note that the new Interger based vector types in 4.0 will make it easier to write your own physics handler for this kind of stuff.
Something I forgot to mention that you might already be aware of, which did contribute to this, was that the move_and_slide perpetually moved downwards. On my tilemap, the node ends up further down and to the left of it's final resting position, instead of "in the center" of the tile. This may be part of a tilemap issue, which I'm about to create an Issue for. With both of these issues I can't make any levels larger than the screen area because the player gets stuck.
Godot version: 3.2.1.stable.official
OS/device including version: Windows 10.0.18362
Issue description: building top down grid like movement game,
move_and_slide
/move_and_collide
add erroneous position data so it moves out of being pixel perfect. So ifx, y
position vector of32,24
would become32.01216, 24.9389
if told tomove_and_slide
/move_and_collide
.Steps to reproduce: tiles are 16x16, CollisionShape Collision2D is 16x16, and using
move_and_*
means that the node has a float position, causing the collision shapes to meet, causing the movement to stop.Minimal reproduction project:
For reference, here's the level:
This is the issue when
move_and_*
is called:The position according to Godot remote:
My solution is to have a smaller collision shape and an additional test
move_and_collide
and if there is a collision then don't move, and have a finalround()
when the node stops moving, to snap it back to pixel position.The text was updated successfully, but these errors were encountered: