Matrix.CreateBillboard Method (Vector3, Vector3, Vector3, Nullable<Vector3>)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Creates a spherical billboard that rotates around a specified object position.

Namespace:  Microsoft.Xna.Framework
Assembly:  Microsoft.Xna.Framework.Math (in Microsoft.Xna.Framework.Math.dll)

Syntax

'Declaration
Public Shared Function CreateBillboard ( _
    objectPosition As Vector3, _
    cameraPosition As Vector3, _
    cameraUpVector As Vector3, _
    cameraForwardVector As Nullable(Of Vector3) _
) As Matrix
public static Matrix CreateBillboard(
    Vector3 objectPosition,
    Vector3 cameraPosition,
    Vector3 cameraUpVector,
    Nullable<Vector3> cameraForwardVector
)

Parameters

Return Value

Type: Microsoft.Xna.Framework.Matrix
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.

Version Information

Silverlight

Supported in: 5

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.