add printing of worldpos in HelloWorld.cpp

This commit is contained in:
ejcoumans 2007-12-15 02:28:39 +00:00
parent 6dff743d68
commit a77fca6394

View File

@ -110,12 +110,23 @@ int main(int argc, char** argv)
/// Do some simulation /// Do some simulation
for (i=0;i<100;i++) for (i=0;i<100;i++)
{ {
dynamicsWorld->stepSimulation(1.f/60.f,10); dynamicsWorld->stepSimulation(1.f/60.f,10);
//print positions of all objects //print positions of all objects
for (i=dynamicsWorld->getNumCollisionObjects()-1; i>=0 ;i--)
{
btCollisionObject* obj = dynamicsWorld->getCollisionObjectArray()[i];
btRigidBody* body = btRigidBody::upcast(obj);
if (body && body->getMotionState())
{
btTransform trans;
body->getMotionState()->getWorldTransform(trans);
printf("world pos = %f,%f,%f\n",float(trans.getOrigin().getX()),float(trans.getOrigin().getY()),float(trans.getOrigin().getZ()));
}
}
} }