Click or drag to resize

UtilGetAlignMatrix(Vector3, Vector3) Method

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: 19.01.00
Syntax
C#
public static Matrix GetAlignMatrix(
	Vector3 initial,
	Vector3 target
)

Parameters

initial  Vector3
Initial vector
target  Vector3
Vector to align with

Return Value

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