Reputation: 1805
I am using the JavaScript port of Bullet Physics, Ammo.js, with Three.js and would like to shift the center of mass of an object. In other words, I want move the center of mass to a specific point and therefore make that part of the object heavier.
The only similar question I could find was this one from 2007 and there is no working code or demo that would resolve the issue. I tried a similar approach to what the user initially attempted, with the same result: The object's center gets moved, instead of just the center of mass.
const info = new Ammo.btRigidBodyConstructionInfo(mass, motionState, shape, localInertia);
const body = new Ammo.btRigidBody(info);
// My attempt, which unfortunately physically moves the object to that vector
body.setCenterOfMassTransform(new Ammo.btVector3(1, 0, 0));
If anyone knows how to achieve this, it would be greatly appreciated. Answers in other languages (like C++) are also welcome if I can translate the concepts/code to Ammo.js.
Upvotes: 0
Views: 54