First person Ammo.js rigid body rotation

65 Views Asked by At

I am making a 3D FPS game using Three.js and Ammo.js, however I am running into the issue of the player Ammo object just falling over and not being able to clamp it so that the Ammo object can only rotate on the Y-Axis

I tried adding

const physicsBody = this.playerEntity.player.userData.physicsBody
physicsBody.setAngularVelocity(new Ammo.btVector3(0.0, 1, 0.0))

in the animation loop, however this just makes the player rotate in a circle and doesn't clamp the X and Z rotation at all

Any tips or advice would be majorly appreciated

0

There are 0 best solutions below