public void TestContactNotify() { XNAGame game = new XNAGame(); game.SpectaterCamera.CameraPosition = new Vector3(0, 0, -40); PhysicsEngine engine = new PhysicsEngine(); engine.AddContactNotification(delegate(ContactPair contactInformation, ContactPairFlag events) { var pos = contactInformation.ActorA.GlobalPosition; game.LineManager3D.AddLine(pos, pos + Vector3.Up * 5, Color.Yellow); pos = contactInformation.ActorB.GlobalPosition; game.LineManager3D.AddLine(pos, pos + Vector3.Up * 5, Color.Orange); }); game.InitializeEvent += delegate { engine.Initialize(); PhysicsDebugRendererXNA debugRenderer = new PhysicsDebugRendererXNA(game, engine.Scene); game.AddXNAObject(debugRenderer); }; game.UpdateEvent += delegate { if (game.Keyboard.IsKeyPressed(Microsoft.Xna.Framework.Input.Keys.F)) { Actor actor = PhysicsHelper.CreateDynamicSphereActor(engine.Scene, 1, 1); actor.GlobalPosition = game.SpectaterCamera.CameraPosition + game.SpectaterCamera.CameraDirection * 5; actor.LinearVelocity = game.SpectaterCamera.CameraDirection * 5; actor.ContactReportFlags = ContactPairFlag.All; //actor.ContactReportThreshold = 10000; } engine.Update(game.Elapsed); }; game.Run(); engine.Dispose(); }