コード例 #1
0
        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.Equal(dynamicBody.BoneWorldMatrix, model.Skeleton.NodeTransformations[dynamicBody.BoneIndex].WorldMatrix);
                Assert.NotEqual(pastTransform, model.Skeleton.NodeTransformations[dynamicBody.BoneIndex].WorldMatrix);

                anim.Play("Run");

                pastTransform = model.Skeleton.NodeTransformations[kinematicBody.BoneIndex].WorldMatrix;

                Assert.Equal(kinematicBody.BoneWorldMatrix, pastTransform);

                await game.Script.NextFrame();

                Assert.NotEqual(kinematicBody.BoneWorldMatrix, pastTransform);

                game.Exit();
            });
            RunGameTest(game);
        }
コード例 #2
0
 /// <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(); }
 }