722 B
722 B
Quaternion::LookRotation
static Quaternion LookRotation(const Vector3& forward, const Vector3& up = Vector3::Up());
创建使 forward 方向朝向目标的旋转四元数。
参数:
forward- 前向方向(会被归一化)up- 向上方向,默认为 Y 轴正方向
返回: 使 forward 朝向目标的旋转四元数
线程安全: ✅
复杂度: O(1)
示例:
#include <XCEngine/Math/Quaternion.h>
#include <XCEngine/Math/Vector3.h>
using namespace XCEngine::Math;
Quaternion q = Quaternion::LookRotation(Vector3(1, 0, 0));
相关文档
- Quaternion - 返回类总览
- FromAxisAngle - 从轴角创建