public override void ProcessCollision(CollisionObject bodyA, CollisionObject bodyB, DispatcherInfo dispatchInfo, ManifoldResult resultOut) { if (_manifold == null) return; SphereShape sphere = bodyA.CollisionShape as SphereShape; TriangleShape triangle = bodyB.CollisionShape as TriangleShape; /// report a contact. internally this will be kept persistent, and contact reduction is done resultOut.SetPersistentManifold(_manifold); SphereTriangleDetector detector = new SphereTriangleDetector(sphere, triangle); DiscreteCollisionDetectorInterface.ClosestPointInput input = new DiscreteCollisionDetectorInterface.ClosestPointInput(); input.MaximumDistanceSquared = 1e30f;//todo: tighter bounds input.TransformA = bodyA.WorldTransform; input.TransformB = bodyB.WorldTransform; detector.GetClosestPoints(input, resultOut, null); }
public override void ProcessCollision(CollisionObject bodyA, CollisionObject bodyB, DispatcherInfo dispatchInfo, ManifoldResult resultOut) { if (_manifold == null) { return; } SphereShape sphere = bodyA.CollisionShape as SphereShape; TriangleShape triangle = bodyB.CollisionShape as TriangleShape; /// report a contact. internally this will be kept persistent, and contact reduction is done resultOut.SetPersistentManifold(_manifold); SphereTriangleDetector detector = new SphereTriangleDetector(sphere, triangle); DiscreteCollisionDetectorInterface.ClosestPointInput input = new DiscreteCollisionDetectorInterface.ClosestPointInput(); input.MaximumDistanceSquared = 1e30f; //todo: tighter bounds input.TransformA = bodyA.WorldTransform; input.TransformB = bodyB.WorldTransform; detector.GetClosestPoints(input, resultOut, null); }