Matrix.CreateLookAt Method (Vector3, Vector3, Vector3)

Creates a view matrix.

Namespace: Microsoft.Xna.Framework
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

Syntax

public static Matrix CreateLookAt (
         Vector3 cameraPosition,
         Vector3 cameraTarget,
         Vector3 cameraUpVector
)

Parameters

  • cameraPosition
    The position of the camera.
  • cameraTarget
    The position for the camera to look at.
  • cameraUpVector
    The world's up, usually [0, 1, 0].

Return Value

The created view matrix.

Remarks

View space, sometimes called camera space, is similar to world space in that it is typically used for the entire scene. However, in view space, the origin is at the viewer or camera.

See Also

Tasks

How to: Rotate and Move a Camera
How to: Make a First-Person Camera
How to: Make a Third-Person Camera

Reference

Matrix Structure
Matrix Members
Microsoft.Xna.Framework Namespace

Platforms

Xbox 360, Windows XP SP2, Windows Vista