如果要围绕世界空间中的任意线旋转对象,可以使用以下方法。该线由3D
point和方向矢量(
axis)指定。
THREE.Object3D.prototype.rotateAroundWorldAxis = function() { // rotate object around axis in world space (the axis passes through point) // axis is assumed to be normalized // assumes object does not have a rotated parent var q = new THREE.Quaternion(); return function rotateAroundWorldAxis( point, axis, angle ) { q.setFromAxisAngle( axis, angle ); this.applyQuaternion( q ); this.position.sub( point ); this.position.applyQuaternion( q ); this.position.add( point ); return this; }}();three.js r.85



