Game Development Reference
In-Depth Information
near and far plane.
// In this case, I select a point 10% between
the two (z=0.1).
Vector3 unprojectPos = Vector3 ( screenPosi-
tion . x ,
screenPosi-
tion . y , 0.1)
// Grab the camera and projection matrices
...
// Call Unproject function from Chapter 8
return Unproject( unprojectPos , cameraMatrix ,
projectionMatrix )
end
function Initialize( Vector2 myScreenPos , Vector3
myWaypoint )
screenPosition = myScreenPos
// For left-handed coordinate system with Y
up
facing = Vector3 (0, 0, 1)
SetNewWaypoint( myWaypoint )
// Initialize the world transform matrix
ComputeMatrix(ComputeWorldPosition(), Qua-
ternion .Identity)
end
function SetNewWaypoint( Vector3 myWaypoint )
waypoint = myWaypoint
end
function Update( float deltaTime )
// Get the current world position of the ar-
row
Vector3 worldPos = ComputeWorldPosition()
Search WWH ::




Custom Search