Matrix.CreateBillboard Method (Vector3, Vector3, Vector3, Nullable<Vector3>, Matrix)
Creates a spherical billboard that rotates around a specified object position.
Syntax
'Declaration
Public Shared Sub CreateBillboard ( _
ref objectPosition As Vector3, _
ref cameraPosition As Vector3, _
ref cameraUpVector As Vector3, _
cameraForwardVector As Nullable(Of Vector3), _
out result As Matrix _
)
public static void CreateBillboard (
ref Vector3 objectPosition,
ref Vector3 cameraPosition,
ref Vector3 cameraUpVector,
Nullable<Vector3> cameraForwardVector,
out Matrix result
)
public:
static void CreateBillboard(
ref Vector3 objectPosition,
ref Vector3 cameraPosition,
ref Vector3 cameraUpVector,
Nullable<Vector3> cameraForwardVector,
out Matrix result
)
Parameters
- objectPosition
Type: Vector3
Position of the object the billboard will rotate around. - cameraPosition
Type: Vector3
Position of the camera. - cameraUpVector
Type: Vector3
The up vector of the camera. - cameraForwardVector
Type: Nullable<Vector3>
Optional forward vector of the camera. - result
Type: Matrix
[OutAttribute] The created billboard matrix.
Remarks
This method computes the facing direction of the billboard from the object position and camera position. When the object and camera positions are too close, the matrix will not be accurate. To avoid this problem, the method uses the optional camera forward vector if the positions are too close.
Requirements
Namespace: Microsoft.Xna.Framework
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
See Also
Reference
Matrix Structure
Matrix Members
Microsoft.Xna.Framework Namespace
Platforms
Windows Phone