Hi, thanks for the tutorial links they are great!
I haven’t had the chance to test the code yet. BUT () It looks to me as though all transforms are flat. As in they are all tied to the scene/world transform (or rather the
.setIdentity() matrix) and not nested children of other Mesh/RigidBody objects. In your example it works fine as the ThreeJS Mesh objects are all children of the Scene.
In the initialisation functions,
let transform = new Ammo.btTransform();
transform.setOrigin( new Ammo.btVector3( pos.x, pos.y, pos.z ) );
transform.setRotation( new Ammo.btQuaternion( quat.x, quat.y, quat.z, quat.w ) );
let motionState = new Ammo.btDefaultMotionState( transform );
It doesn’t look like parent transforms are factored in.
And neither in the
ms.getWorldTransform( tmpTrans );
let p = tmpTrans.getOrigin();
let q = tmpTrans.getRotation();
objThree.position.set( p.x(), p.y(), p.z() );
objThree.quaternion.set( q.x(), q.y(), q.z(), q.w() );
.getWorldTransform is computed, but nested transforms weren’t setup in the
Is it the case that for this tutorial we just don’t worry about nested transforms or will this still work?
Is bullet even designed to work this way with nested transforms (Possibly need to use some sort of weld joint instead)?
If so, do you know what the extra steps required would be to include a joint or parent/child relationship?