Closed Druidhawk closed 8 years ago
Thanks for reminding me I need to make this a wiki page
var body = new Goblin.RigidBody(
new Goblin.SphereShape( 1 ),
50
);
body.addListener(
'newContact',
function( other_body, contact ) {
// `other_body` is the rigid body this body is in contact with
// `contact` is a ContactDetails object http://www.goblinphysics.com/documentation/classes/ContactDetails.html
}
);
Note that in the current version this will be called every step that the objects are in contact; you will need to determine if this is the first time the missile hit your object. It is planned for future versions to split this into three events - one for the possible contact ( so it can be ignored ), another for every new contact, and lastly one to fire when there aren't other contacts between the objects. If you need some of this functionality now let me know and I'll move some things around.
Wiki page for contact events created at https://github.com/chandlerprall/GoblinPhysics/wiki/Collision-Events
I do not immediately see how I can listen, react, to collisions. If a missile strikes a shape I want to show particles, for example.