# Viewport.Unproject Method

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

A common use for **Unproject** is determining if the current cursor location intersects with an object in 3D world
space. First, calculate two Vector3 values that differ only by their Z value. For
instance, assume that the cursor location is currently (100, 100). Therefore, the first vector (located at the
near clip plane) becomes (100, 100, 0) and the second (located at the far clip plane) becomes (100, 100, 1).

Call **Unproject** for each point, and store the result. For example, `minPointSource`

stores the result
of "unprojecting" (100,100,0), and `maxPointSource`

stores the result of "unprojecting" (100, 100,
1). Determine the direction vector by subtracting `maxPointSource`

from
`minPointSource`

.

Finally, normalize the direction vector, and create a Ray with
`minPointSource`

and the now-normalized direction vector. You can now use this ray in a simple
intersect test case (for example, Intersects) with the model.

For more usage examples of **Unproject**, see the following: