Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to disable x & z rotation in ammo.js?

Well, Is it possible to disable x & z rotation in ammo.js? (I want to create a FPS Player and I want to keep it in vertical position)

like image 254
user2462898 Avatar asked Oct 27 '25 10:10

user2462898


1 Answers

In bullet there is btRigidBody::setAngularFactor which takes a btVector3 as argument, where x, y and z corresponds to rotation along those axis. Use a 1 to allow motion, and 0 to disallow motion along a certain axis.

If you want to allow rotation only along the Y axis in ammo.js, use:

body.setAngularFactor( 0, 1, 0 );

See http://www.bulletphysics.org/mediawiki-1.5.8/index.php/Code_Snippets

like image 80
Falk Thiele Avatar answered Oct 29 '25 00:10

Falk Thiele



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!