I'm using PhysX.NET (C# wrapper for PhysX) and I am trying to get a notification of collision between two spheres using onContact in SimulationEventCallBack.
I have created a new subclass for SimulationEventCallback and overridden the OnContact method so that it will give me a message when collision happens. I have then set the simulationEventCallback of the scene to an instance of my subclass. This does not work even though the two spheres (rigid dynamic) obviously collide. Below is my code:
// Creating subclass
public class robotCollision : SimulationEventCallback
{
public override void OnContact(ContactPairHeader pairHeader, ContactPair[] pairs)
{
base.OnContact(pairHeader, pairs);
Rhino.RhinoApp.Write("Contact!");
}
}
// Create scene
scene = engine.CreateScene(sceneDesc);
scene.SetSimulationEventCallback(myContactCallback,0);
Is there something else that needs to be considered? Any flags to be set? I am sorry if this is a very naive question, but I have worked on this for the whole day for something that seems to be quite simple and I can't wrap my head around it.
Thanks in advance.