Beispiel #1
0
 protected void InitPlayer() {
     Arnold = new Player(this);
     Arnold.Position = new Vector3(0.0f, 35.0f, 0.0f);
     // The LookAtVec.XZ will be normalized for turning purposes
     Arnold.LookAtVec = new Vector3(0.0f, 0.0f, -1.0f);  // this is a vector for only X, Z component, 
     // Y will be accounted for when call Matrix.CreateLookAt()
     Components.Add(Arnold);
 }
Beispiel #2
0
        protected void InitPlayer()
        {
            Arnold = new Player(this);
            Arnold.Position = new Vector3(0.0f, 16.0f, 0.0f);
            // The LookAtVec.XZ will be normalized for turning purposes
            Arnold.LookAtVec = new Vector3(0.0f, 0.0f, -1.0f);  // this is a vector for only X, Z component,
                                                                // Y will be accounted for when call Matrix.CreateLookAt()

            viewMatrix = Matrix.CreateLookAt(Arnold.Position, (Arnold.Position + Arnold.LookAtVec), Vector3.Up);
            projectionMatrix = Matrix.CreatePerspectiveFieldOfView(
                    MathHelper.ToRadians(45),
                    (float)graphics.GraphicsDevice.Viewport.Width / (float)graphics.GraphicsDevice.Viewport.Height,
                    0.1f, 5000.0f);

            Arnold.ViewMatrix = viewMatrix;
            Arnold.ProjectionMatrix = projectionMatrix;
            Components.Add(Arnold);
        }