Game Development Reference
In-Depth Information
void
BulletOpenGLApplication::CollisionEvent(const
btCollisionObject * pBody0, const
btCollisionObject * pBody1) {
GameObject* pObj0 =
FindGameObject((btRigidBody*)pBody0);
pObj0->SetColor(btVector3(1.0,1.0,1.0));
GameObject* pObj1 =
FindGameObject((btRigidBody*)pBody1);
pObj1->SetColor(btVector3(1.0,1.0,1.0));
}
Note
Note that these color changing commands are commented out in future project
code.
When we launch the application, we should expect colliding and separating objects
to change to the colors give in CollisionEvent() . Colliding objects should turn
white, and separated objects should turn black. But, when objects have finished
moving, we observe something that might seem a little counterintuitive. The following
screenshot shows the two objects colored differently once they come to rest:
Search WWH ::




Custom Search