Share via


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

Creates a cylindrical billboard that rotates around a specified axis.

Syntax

'Declaration
Public Shared Function CreateConstrainedBillboard ( _
         objectPosition As Vector3, _
         cameraPosition As Vector3, _
         rotateAxis As Vector3, _
         cameraForwardVector As Nullable(Of Vector3), _
         objectForwardVector As Nullable(Of Vector3) _
) As Matrix 
public static Matrix CreateConstrainedBillboard (
         Vector3 objectPosition,
         Vector3 cameraPosition,
         Vector3 rotateAxis,
         Nullable<Vector3> cameraForwardVector,
         Nullable<Vector3> objectForwardVector
)
public:
static Matrix CreateConstrainedBillboard(
         Vector3 objectPosition,
         Vector3 cameraPosition,
         Vector3 rotateAxis,
         Nullable<Vector3> cameraForwardVector,
         Nullable<Vector3> objectForwardVector
)

Parameters

  • objectPosition
    Type: Vector3
    Position of the object the billboard will rotate around.
  • cameraPosition
    Type: Vector3
    Position of the camera.
  • rotateAxis
    Type: Vector3
    Axis to rotate the billboard around.
  • cameraForwardVector
    Type: Nullable<Vector3>
    Optional forward vector of the camera.
  • objectForwardVector
    Type: Nullable<Vector3>
    Optional forward vector of the object.

Return Value

Type: 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.

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