- Edited
Hi! I made a Godot project where I use the move_and_collide() function to check if the player is colliding with platforms and ground. I have two computers that I use to work on my projects depending on the circumstances, and my problem is that my collision system works perfectly in one of the computer (basically the one I programmed the core of the game in), and does not on the other, with the exact same project (I use Google Drive so it's literally the same files).
I basically use the move_and_collide() function to later check if it returns collisions or not:
collision = move_and_collide(velocity * delta)
Then I check if collision is null or contains objects I collided with:
func is_colliding():
if collision != null:
return true
else:
return false
Then I have a function to check if the player is on air or not (basically return the opposite of is_colliding):
func is_on_air():
return !is_colliding()
And I also have a function that make the player stick to a platform until he jumps:
if !is_on_air():
velocity = Vector2.ZERO
print("Not on air")
else:
print("On air")
Now, while that works perfectly on one of my computer, it does not on the other. The reason is clear when I try to print if the player is "on air" or not... See below:
You can see in the console that, on this computer, the player is never on air when it's on the ground (this version is working as intended)
But in this one, it's not the case:
EDIT: Ok when I look close enough I can see that, on the computer where the game that does not work properly, the character jiggle a bit. I have no idea why but this is definitely where the problem come from. Any idea on why?? Here is a GIF so you can see what I'm talking about:
I have a link to the project if some of you want to directly check the code: https://we.tl/t-seNvnM9Khp
So I have two questions: 1. Am I using the move_and_collide() function incorrectly, or doing something wrong or stupid ? I guess so, but I'm not sure because it's working perfectly on one of the computer. 2. Even though it's a stupid way to program a player that sticks on the platforms, and even though I'm definitely interested in a different and better/proper way to do it, I'm also VERY interested in understanding why the exact same project works perfectly on one of my computer and not on the other ??
I'm very new to Godot and this kind of engine in general (before I was working with Love2D engine to make games), but I want to understand this inconsistency, because that's very scary to think that such a simple project can works well on my computer but absolutely not on a player's computer... Like, it sincerely worry me...
Thanks for the help guys.