Atlaslog
Atlaslog / three.js / API reference / Quaternion
three.js · API reference

Quaternion

Quick answer

Quaternion represents a 3D rotation with four components, avoiding gimbal lock and interpolating smoothly through slerp(). Object3D stores rotation internally as a quaternion and syncs it with the Euler rotation property. Use setFromAxisAngle(), setFromEuler(), or setFromUnitVectors() to construct normalized unit orientations.

Last verified 2026-11-03 · three.js 0.160.0 · Cite this page
new THREE.Quaternion ( x , y , z , w )
Key points
Example
const forward = new THREE.Vector3(0, 0, 1);
const direction = new THREE.Vector3()
  .subVectors(target, mesh.position)
  .normalize();

mesh.quaternion.setFromUnitVectors(forward, direction);
const targetQuat = mesh.quaternion.clone();
mesh.quaternion.slerp(targetQuat, 0.15);
const axis = new THREE.Vector3(0, 1, 0).normalize();
const delta = new THREE.Quaternion().setFromAxisAngle(axis, 0.01);
mesh.quaternion.multiply(delta);
mesh.quaternion.normalize();   // 长时间累乘后防止漂移
Notes
Runnable examplesChinese originalAll API references
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Cite this page

Atlaslog (2026). Quaternion. https://www.jingweizhi.com/en/three/api/quaternion.html (accessed 2026-11-03).