kripken / ammo.js

Direct port of the Bullet physics engine to JavaScript using Emscripten
Other
4.11k stars 556 forks source link

btRigidBody applyForce applyImpulse methods missing? #410

Open dataexcess opened 1 year ago

dataexcess commented 1 year ago

Hello!

I am looking for the following methods (present in the API docs of pybullet (https://pybullet.org/Bullet/BulletFull/classbtRigidBody.html)

Currently (please correct me if I'm wrong) the only method that seems available to set a rigid body in motion is the setLinearVelocity. The problem is that it ignores/circumvents other forces such as gravity it seems.

Thank you!

lo-th commented 1 year ago

you can use v = b.getLinearVelocity() and add your velocity to v and apply setLinearVelocity

note velocity is in world coordinate so you can apply rotation of your object before add

you can also use b.applyForce( v ) b.applyTorque(v) b.applyCentralForce(v) b.applyImpulse(v) b.applyCentralImpulse(v)