PEXLookAtViewMatrix(3) — Subroutines
Name
PEXLookAtViewMatrix
Synopsis
int PEXLookAtViewMatrix(PEXCoord ∗from, PEXCoord ∗to, PEXVector ∗up, PEXMatrix matrix_return)
Arguments
fromViewing position, in world coordinates.
toLook at position, in world coordinates.
upVector representing the "up" direction, in world coordinates.
matrix_return
matrix in which result is stored
Returns
Zero if successful; otherwise, one of the following:
PEXBadVectors - the from and to arguments are equal, or the line between
them is parallel with the up vector
PEXBadVector - up is zero length
Description
This function creates a view orientation transform that defines the viewing direction and orientation. It is a slightly more intuitive interface to PEXViewOrientationMatrix.
The "from" position defines the viewpoint, and the "to" position specifies the point being viewed. These two parameters together define the view reference point (the VRC origin) and the view plane normal of PEXViewOrientationMatrix. The view reference point is the "to" point; the view plane normal is the vector from "to" to "from".
The view up vector is a 3D vector defined in world coordinates relative to the "to" point. The projection of this vector onto the plane through the "to" point and perpendicular to the view plane normal defines the Y axis of VRC.
Errors
None
See Also
PEXPolarViewMatrix, PEXViewOrientationMatrix, PEXViewMappingMatrix