public void SkinnedTest1() { var game = new SkinnedTest(); game.Script.AddTask(async() => { game.ScreenShotAutomationEnabled = false; await game.Script.NextFrame(); await game.Script.NextFrame(); var character = game.SceneSystem.SceneInstance.RootScene.Entities.First(ent => ent.Name == "Model"); var dynamicBody = character.GetAll <RigidbodyComponent>().First(x => !x.IsKinematic); var kinematicBody = character.GetAll <RigidbodyComponent>().First(x => x.IsKinematic); var model = character.Get <ModelComponent>(); var anim = character.Get <AnimationComponent>(); var pastTransform = model.Skeleton.NodeTransformations[dynamicBody.BoneIndex].WorldMatrix; //let the controller land var twoSeconds = 120; while (twoSeconds-- > 0) { await game.Script.NextFrame(); } Assert.AreEqual(dynamicBody.BoneWorldMatrix, model.Skeleton.NodeTransformations[dynamicBody.BoneIndex].WorldMatrix); Assert.AreNotEqual(pastTransform, model.Skeleton.NodeTransformations[dynamicBody.BoneIndex].WorldMatrix); anim.Play("Run"); pastTransform = model.Skeleton.NodeTransformations[kinematicBody.BoneIndex].WorldMatrix; Assert.AreEqual(kinematicBody.BoneWorldMatrix, pastTransform); await game.Script.NextFrame(); Assert.AreNotEqual(kinematicBody.BoneWorldMatrix, pastTransform); game.Exit(); }); RunGameTest(game); }
public void SkinnedTest1() { var game = new SkinnedTest(); game.Script.AddTask(async () => { game.ScreenShotAutomationEnabled = false; await game.Script.NextFrame(); await game.Script.NextFrame(); var character = game.SceneSystem.SceneInstance.Scene.Entities.First(ent => ent.Name == "Model"); var dynamicBody = character.GetAll<RigidbodyComponent>().First(x => !x.IsKinematic); var kinematicBody = character.GetAll<RigidbodyComponent>().First(x => x.IsKinematic); var model = character.Get<ModelComponent>(); var anim = character.Get<AnimationComponent>(); var pastTransform = model.Skeleton.NodeTransformations[dynamicBody.BoneIndex].WorldMatrix; //let the controller land var twoSeconds = 120; while (twoSeconds-- > 0) { await game.Script.NextFrame(); } Assert.AreEqual(dynamicBody.BoneWorldMatrix, model.Skeleton.NodeTransformations[dynamicBody.BoneIndex].WorldMatrix); Assert.AreNotEqual(pastTransform, model.Skeleton.NodeTransformations[dynamicBody.BoneIndex].WorldMatrix); anim.Play("Run"); pastTransform = model.Skeleton.NodeTransformations[kinematicBody.BoneIndex].WorldMatrix; Assert.AreEqual(kinematicBody.BoneWorldMatrix, pastTransform); await game.Script.NextFrame(); Assert.AreNotEqual(kinematicBody.BoneWorldMatrix, pastTransform); game.Exit(); }); RunGameTest(game); }
/// <summary> /// This is useful if you want to run all the tests on your own machine and compare images /// </summary> public static void Main() { using (var game = new ColliderShapesTest()) { game.ColliderShapesTest1(); } using (var game = new CharacterTest()) { game.CharacterTest1(); } using (var game = new SkinnedTest()) { game.SkinnedTest1(); } }
/// <summary> /// This is useful if you want to run all the tests on your own machine and compare images /// </summary> public static void Main() { using (var game = new ColliderShapesTest()) { game.ColliderShapesTest1(); } using (var game = new CharacterTest()) { game.CharacterTest1(); } using (var game = new SkinnedTest()) { game.SkinnedTest1(); } }