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
Prelude:
I spent the last couple days isolating this and finally found a solution. I was thinking of not making a bug report because it might be an edge case, but I feel like it's important enough. And other Godot developers might be affected by it.
Issue description:
When moving with diagonal movement, round()must be used if the player's global_position is an even number, and floor() must be used if the player's global_position is an odd number. Otherwise, diagonal movement will cause jitter. This also happens using Camera2D, but I chose custom_transform to show what happens with and without .round().
New Problem: When the character is moving, white/black lines will flicker all over the tilemap. The developer can partially fix this by disabling the filter property for that specific tileset texture.
Next New Problem: Now, when the above is done, the lines will appear sporadically, not all the time.
New Problem: Diagonal movement is smooth, but sprites being modified by the AnimationPlayer now become distorted/not smooth (for example, using a animated character like gBot)
Remove normalized() from char_direction
New Problem: Diagonal movement now becomes faster than horizontal movement (entire point of normalized() is to achieve the same speed.
The solution to get everything working smoothly is around line 34, in player.gd:
if is_diagonal && gg.diagonal_fix == true:
# Even
if speed % 2 == 0:
global_position = global_position.round()
else: # Odd
global_position = global_position.floor()
I might have forgot another way that makes the diagonal movement smooth which has weird side effects; but I think this is sufficient. Thanks for taking a look!
The text was updated successfully, but these errors were encountered:
Godot version:
51c1d55
OS/device including version:
Windows 10, GTX 950
Prelude:
I spent the last couple days isolating this and finally found a solution. I was thinking of not making a bug report because it might be an edge case, but I feel like it's important enough. And other Godot developers might be affected by it.
Issue description:
When moving with diagonal movement,
round()
must be used if the player's global_position is an even number, and. Otherwise, diagonal movement will cause jitter. This also happens using Camera2D, but I chosefloor()
must be used if the player's global_position is an odd numbercustom_transform
to show what happens with and without.round()
.Minimal reproduction project:
SmoothDiagonalMovementBug.zip
Ways to remove the diagonal movement jitter:
.round()
fromtransform2[2]
.filter
property for that specific tileset texture.normalized()
fromchar_direction
normalized()
is to achieve the same speed.The solution to get everything working smoothly is around line 34, in player.gd:
I might have forgot another way that makes the diagonal movement smooth which has weird side effects; but I think this is sufficient. Thanks for taking a look!
The text was updated successfully, but these errors were encountered: