I'm currently overriding the 'Events_InitialCollisionDetected' method, is this the best one to use?
Code: Select all
protected override void Events_InitialCollisionDetected(EntityCollidable info, BroadPhaseEntry entry, NarrowPhasePair pair)
- I could ignore contacts that belong to the same object each frame but what about a box where the object rolls along one side and collides with another wall belonging to the same box?
- What if the object is rolling on an uneven surface so I can't use normals to determine if the contact should count?
Impact force or collision sensitivity
- I thought about using the value of NormalImpulse but I'm uncertain if that is the correct method?
Code: Select all
// Determine if a valid collidable pair has been created
var collidablePair = pair as CollidablePairHandler;
if (collidablePair == null)
{
return;
}
float collisionSensitivity = 1f;
float impulse = collidablePair.Contacts[0].NormalImpulse;
if (impulse > collisionSensitivity)
{
Console.WriteLine("Collision Detected");
}
Here's a video of a spherical object moving inside a hollow cube. The object will flash and play a sound each time a new collision is detected without the above methods in place:
http://youtu.be/0GlBv7OLjxg
Some thoughts and help on this issue would be great. I would like to know if I have the correct idea before going down this route.