Exemplo n.º 1
0
        public void TestFollowCurve()
        {
            XNAGame game = new XNAGame();

            Curve3D curve = Curve3D.CreateTestCurve();

            game.SpectaterCamera.CameraDirection = Vector3.Normalize(new Vector3(-0.2f, -1f, -0.4f));
            BoundingSphere sphere = curve.CalculateBoundingSphere();

            sphere.Radius += 1.5f;
            game.SpectaterCamera.FitInView(sphere);

            float time = 0;

            game.DrawEvent +=
                delegate
            {
                if (game.Keyboard.IsKeyPressed(Keys.V))
                {
                    game.SpectaterCamera.CameraDirection = Vector3.Normalize(new Vector3(-0.2f, -1f, -0.4f));
                }
                Render(curve, game, Color.Red);
                game.LineManager3D.AddCenteredBox(curve.Evaluate(time), 0.2f, Color.Green);
                time += game.Elapsed;
            };


            game.Run();
        }