Ejemplo n.º 1
0
        public void OnConstraintBreakIsCalled()
        {
            using (var physics = CreatePhysicsAndScene())
            {
                var callback = new MockSimulationEventCallback();

                physics.Scene.SetSimulationEventCallback(callback, 0);

                var box = CreateBoxActor(physics.Scene, new Vector3(5, 5, 5), new Vector3(0, 10, 0));

                var joint = physics.Scene.CreateJoint <SphericalJoint>(box, Matrix4x4.Identity, null, Matrix4x4.CreateTranslation(0, 50, 0));
                joint.BreakForce = 0.001f;
                //joint.ConstraintFlag = ConstraintFlag.Reporting;

                for (int i = 0; i < 200; i++)
                {
                    physics.Scene.Simulate(0.2f);
                    physics.Scene.FetchResults(block: true);
                }

                Assert.IsTrue(callback.BrokenJoints.Contains(joint));
            }
        }
Ejemplo n.º 2
0
		public void OnConstraintBreakIsCalled()
		{
			using (var physics = CreatePhysicsAndScene())
			{
				var callback = new MockSimulationEventCallback();

				physics.Scene.SetSimulationEventCallback(callback, 0);

				var box = CreateBoxActor(physics.Scene, new Vector3(5, 5, 5), new Vector3(0, 10, 0));

				var joint = physics.Scene.CreateJoint<SphericalJoint>(box, Matrix.Identity, null, Matrix.Translation(0, 50, 0));
				joint.BreakForce = 0.001f;
				joint.ConstraintFlag = ConstraintFlag.Reporting;

				for (int i = 0; i < 200; i++)
				{
					physics.Scene.Simulate(0.2f);
					physics.Scene.FetchResults(block: true);
				}

				Assert.IsTrue(callback.BrokenJoints.Contains(joint));
			}
		}