Microsoft DirectX 9.0 SDK Update (October 2004)

UnsafeNativeMethods.Matrix.LookAtLH Method

Language:

Note: This documentation is preliminary and is subject to change.

Builds a left-handed look-at matrix.

Note: For programming in Microsoft® Visual Basic® .NET or Microsoft® JScript® .NET, use the equivalent method in the Microsoft.DirectX structures.

Definition

Visual Basic .NET Public Shared Function LookAtLH( _
    ByVal pOut As Matrix, _
    ByVal cameraPosition As Vector3, _
    ByVal cameraTarget As Vector3, _
    ByVal cameraUpVector As Vector3 _
) As Matrix
C# public static Matrix LookAtLH(
    Matrix pOut,
    Vector3 cameraPosition,
    Vector3 cameraTarget,
    Vector3 cameraUpVector
);
Managed C++ public: static Matrix LookAtLH(
    Matrix pOut,
    Vector3 cameraPosition,
    Vector3 cameraTarget,
    Vector3 cameraUpVector
);
JScript .NET public static function LookAtLH(
    pOut : Matrix,
    cameraPosition : Vector3,
    cameraTarget : Vector3,
    cameraUpVector : Vector3
) : Matrix;

Parameters

pOut Microsoft.DirectX.Matrix. A Matrix structure that is a left-handed look-at matrix.
cameraPosition Microsoft.DirectX.Vector3. A Vector3 structure that defines the camera point. This value is used in translation.
cameraTarget Microsoft.DirectX.Vector3. A Vector3 structure that defines the camera look-at target.
cameraUpVector Microsoft.DirectX.Vector3. A Vector3 structure that defines the up direction of the current world, usually [0, 1, 0].

Return Value

Microsoft.DirectX.Matrix . A Matrix structure that is a left-handed look-at matrix.

Remarks

This method uses the following formula to compute the returned matrix.

zaxis = normal(cameraTarget - cameraPosition)
xaxis = normal(cross(cameraUpVector, zaxis))
yaxis = cross(zaxis, xaxis)

 xaxis.x           yaxis.x           zaxis.x          0
 xaxis.y           yaxis.y           zaxis.y          0
 xaxis.z           yaxis.z           zaxis.z          0
-dot(xaxis, cameraPosition)  -dot(yaxis, cameraPosition)  -dot(zaxis, cameraPosition)  1

The return value for this method is the same value returned in the pOut parameter. Resultantly, the LookAtLH method can be used as a parameter for another method.

See Also


© 2004 Microsoft Corporation. All rights reserved. Terms of use.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center