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, createBall
and createBlock
.
let transform = new Ammo.btTransform();
transform.setIdentity();
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 updatePhysics
function:
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() );
Here the .getWorldTransform
is computed, but nested transforms werenāt setup in the createBlock
and createBall
functions.
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?
Thanks again!