Click or drag to resize

UtilGetAlignMatrix Method (Vector3, Vector3)

Get the rotation matrix needed to align the initial vector with the target vector.

Namespace:  Demo3D.Common
Assembly:  Demo3D.Common (in Demo3D.Common.dll) Version: 15.0.2.11458
Syntax
C#
public static Matrix GetAlignMatrix(
	Vector3 initial,
	Vector3 target
)

Parameters

initial
Type: Microsoft.DirectXVector3
Initial vector
target
Type: Microsoft.DirectXVector3
Vector to align with

Return Value

Type: Matrix
Alignment matrix
Remarks
This function will arbitrarily select a rotation axis in the case where the two vectors are antiparallel. Use GetAlignMatrix(Vector3, Vector3, Vector3) to manually specify a fallback axis instead.
See Also