Using this example PointerLock, i’m trying to make a simple map and add some inetractions later.
My problem is: the camera before “Play” is normal, but when I press Play, it moves on my Y axe and my player is pushed to the ground. I couldn’t figure out why. Any help please?
my code : https://codepen.io/Imsenji/pen/bGarPVX?editors=0010
The problem lies in line 224 here:
controls.getObject().position.y += velocity.y * delta * 20; // new behavior
When you remove this line it seems to work like expected. I’m not sure what exactly you’re trying to calculate there though.
Thank you for your answer !
actually when i remove this line, it doesn’t jump anymore
do position.y = Math.max (0, position.y)
already tried that, doesn’t seem to work