Home | Tutorials | Wiki | Issues
Ask Your Question

Revision history [back]

Hi,

The way 'OnUpdate' is called on every world update, another function ('onContact') will be called when a collision is detected. Here is the main idea:

// set the collision you wish to check
physics::CollisionPtr collision = this->model->GetLink("link_name")->GetCollision("collision_name");

// during a collision the 'onContact' function will be called every update step
event::ConnectionPtr connection = collision->ConnectContact(boost::bind (&ModelPush::onContact, this, _1, _2));

// the 'onContact' function
void ModelPush::onContact(const std::string &_collisionName, const physics::Contact &_contact)
{ 
// do what you need with the contact 
 ...
}

Here you can find more about physics::Contact.

If you have any trouble implementing it, let me know.

Cheers, Andrei