Solved!

Post Reply
johnsonalpha
Posts: 73
Joined: Fri May 01, 2015 8:23 pm

Solved!

Post by johnsonalpha »

heres my code im not sure how to get the world transform of the compoundshapes child

here my code


// make compound
btCompoundShape* g1 = new btCompoundShape();

btCollisionShape* boxshape = new btBoxShape(btVector3(20, 20, 20));
g1->addChildShape( startTransform , boxshape );

// add rigid body to world
g1->calculateLocalInertia(commass, cominer);
btRigidBody::btRigidBodyConstructionInfo fallRigidBodyCI(commass,comMotionState, g1, cominer);
btRigidBody* comRigidBody = new btRigidBody(fallRigidBodyCI);

dynamicsWorld->addRigidBody(comRigidBody);

// this all works fine this is where im not sure what to do

btTransform 2;

// getchildtransform returns the local transform on the child shape
btTransform 1 = g1->getChildTransform(1);

comRigidBody->getMotionState()->getWorldTransform(2)

// how do i calculate the child world transform from the compoundrigidbody world transform and the child local position
btTransform childworldtrans = 2 * 1;
Post Reply