public void camUpdate(GameCamera cam, Vector3 mdlPosition)
 {
     camPosition = mdlPosition + new Vector3(0.0f, 3.0f, 15.0f);
     //cam.camLookat = mdlPosition - ((Vector3.UnitX) * -(float)Math.Sin(mdlRotation) * 0.05f * 15.0F) + ((Vector3.UnitZ) * (float)Math.Cos(mdlRotation) * 0.05f * 15.0F);
     //cam.camRotationMatrix = -Matrix.CreateRotationY(mdlRotation);
     //cam.camTransform = Vector3.Transform(Vector3.Forward, cam.camRotationMatrix);
     cam.camViewMatrix = Matrix.CreateLookAt(cam.camPosition, cam.camLookat, Vector3.Up);
 }
 public void camUpdate(GameCamera cam, Vector3 mdlPosition, float mdlRotation)
 {
     cam.camPosition = mdlPosition + new Vector3(0.0f, 0.0f, 0.0f);
     //    if (mdlRotation != 0f)
     //    {
     //        cam.camRotationMatrix = Matrix.CreateRotationY(mdlRotation);
     //    }
     //    if (cam.camYaw != 0f)
     //    {
     //        cam.camRotationMatrix = - Matrix.CreateRotationZ(cam.camYaw);
     //        Console.WriteLine("True");
     //    }
     //    cam.camPosition = mdlPosition + ((Vector3.UnitX) * -(float)Math.Sin(mdlRotation) * 25.0f) + ((Vector3.UnitZ) * (15 - (float)Math.Sin(mdlRotation) * 25.0f)) + Vector3.UnitY*10;
     //    //cam.camPosition = mdlPosition + new Vector3(0.0f, 3.0f, 15.0f);
     //    cam.camLookat = mdlPosition - ((Vector3.UnitX) * -(float)Math.Sin(mdlRotation) * 0.05f) + ((Vector3.UnitZ) * (float)Math.Cos(mdlRotation) * 0.05f);
     cam.camLookat = camPosition;
     cam.camViewMatrix = Matrix.CreateLookAt(camPosition, camLookat, Vector3.Up);
 }
예제 #3
0
        private void InitializeTransform()
        {
            player1 = new Player();

            camera = new GameCamera(player1.playerPosition);
            aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;

            camera.camViewMatrix = Matrix.CreateLookAt(camera.camPosition, Vector3.Zero, Vector3.Up);

            camera.camProjectionMatrix = Matrix.CreatePerspectiveFieldOfView(
                MathHelper.ToRadians(45), aspectRatio, 1.0f, 350.0f);
        }