I’m trying to create a infinite runner game, just like the no-internet google dino game, here’s the playground.
Currently the character is the cylinder, using the space bar we can jump but I’m dealing with a issue that the cylinder moves to some directions after a couple of jumps, also, sometimes we can see that the cylinder kind fit on its position again, like a ball rolling on a semi-circle.
On the lines 73 and 74 I’m trying to force the mesh to keep on the same
z, just like I’ve done with
rotation but for some reason the mesh keeps repositioning itself after jump
Also, after I lock the rotation I got a strange bug that the mesh sometimes go inside the ground, commenting line 69 it don’t go inside the ground anymore, but the mesh starts to rotate after a couple of jumps, falling from the ground. This makes me think that could be a better way to prevent mesh to rotate.
So, I have two doubts:
How can I properly prevent my mesh from keep repositioning on
How can I properly prevent my mesh from rotate on