UnityQuaternionExtensions.GetCameraRotationToTarget Method

Cinemachine

UnityQuaternionExtensionsGetCameraRotationToTarget Method

Get the rotations, first about world up, then about (travelling) local right, necessary to align the quaternion's forward with the target direction. This represents the tripod head movement needed to look at the target. This formulation makes it easy to interpolate without introducing spurious roll.

Namespace:  Cinemachine.Utility
Assembly:  Cinemachine (in Cinemachine.dll) Version: 2.0.0.0 (2.0.0.0)
Syntax
public static Vector2 GetCameraRotationToTarget(
	this Quaternion orient,
	Vector3 lookAtDir,
	Vector3 worldUp
)
Cinemachine.Utility.UnityQuaternionExtensions.GetCameraRotationToTarget = function(orient, lookAtDir, worldUp);

Parameters

orient
Type: Quaternion

[Missing <param name="orient"/> documentation for "M:Cinemachine.Utility.UnityQuaternionExtensions.GetCameraRotationToTarget(UnityEngine.Quaternion,UnityEngine.Vector3,UnityEngine.Vector3)"]

lookAtDir
Type: Vector3
The worldspace target direction in which we want to look
worldUp
Type: Vector3
Which way is up

Return Value

Type: Vector2
Vector2.y is rotation about worldUp, and Vector2.x is second rotation, about local right.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Quaternion. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also