Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include btTransformUtil functions? #429

Open
regnaio opened this issue Jul 14, 2024 · 1 comment
Open

Include btTransformUtil functions? #429

regnaio opened this issue Jul 14, 2024 · 1 comment

Comments

@regnaio
Copy link

regnaio commented Jul 14, 2024

Kinematic btRigidBody example by Erwin Coumans - creator of Bullet Physics

btTransformUtil::integrateTransform(m_groundBody->getWorldTransform(), linearVelocity, angularVelocity, dt, predictedTrans);

m_groundBody->getMotionState()->setWorldTransform(predictedTrans);

I'd like to use this useful btTransformUtil::integrateTransform() function in ammo.js. Can we expose this function in ammo.js?

btTransformUtil::integrateTransform() source in bulletphysics/bullet3

@regnaio
Copy link
Author

regnaio commented Jul 15, 2024

Figured out how to do this. Added the following to ammo.idl:

interface btTransformUtil {
  static void integrateTransform([Const, Ref] btTransform curTrans, [Const, Ref] btVector3 linvel, [Const, Ref] btVector3 angvel, float timeStep, [Ref] btTransform predictedTransform);
};

After building ammo.js, this can then be called in JS by:

Ammo.btTransformUtil.prototype.integrateTransform(...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant