Keep box upright by fixing rotation


I’m going to create a TPS/FPS game using Babylon.js

I try to let players (boxes) stand upright and stack together after collision detection by physics engine. However, the reaction force makes them bounce and slide:

How can I “turn off” reaction force in physics engine and make the movement of boxes looks like FPS game, like CS? Many thanks!

mmm… I found out that for my case, I should better use moveWithCollision with a Vector3 adding up with all movement changes

I am making my own fps too!

I use object.rotationQuaternion.x = 0; and object.rotationQuaternion.z = 0; in the register before render function. object.rotationQuaternion.y = 0; would prevent the player from looking sideways.
But that might be an issue, as I use 2 spheres and a cylinder to make a capsule, and a custom movement function. Also, good luck finding a solution to slopes! aka “stair clipping”. One way is to turn off gravity when on slopes. My fps is going to be different from others just so I could avoid that issue. Can’t wait to see it come out!

You can announce it under the games/projects category on the forums!

Welcome to the community!


PS. Here is my playground for the fps:

I was stuck on looking left/right when stopped because I used .sleep when not moving to prevent sliding down slopes. I didn’t find a solution, but feel free to copy any code you like. (wait for the model city to load) was my first fps attempt. because it uses the default camera movement/gravity, jumping is not possible. Controls:

WASD move
C toggle crouch
F toggle freecam

ctrl-u to see the code. click on the js file.

Good luck!


I have since changed how the fps is going to play. It should make it fun and interesting to play.