提交 65ea3db9 编写于 作者: M MichaelHazani

add rotateOnWorldAxis method to Object3D

上级 5b963808
......@@ -320,6 +320,15 @@
Rotate an object along an axis in object space. The axis is assumed to be normalized.
</div>
<h3>[method:Object3D rotateOnWorldAxis]( [page:Vector3 axis], [page:Float angle] )</h3>
<div>
axis -- A normalized vector in world space. <br />
angle -- The angle in radians.<br /><br />
Rotate an object along an axis in world space. The axis is assumed to be normalized.
Method Assumes no rotated parent.
</div>
<h3>[method:null rotateX]( [page:Float rad] )</h3>
<div>
rad - the angle to rotate in radians.<br /><br />
......
......@@ -170,6 +170,26 @@ Object.assign( Object3D.prototype, EventDispatcher.prototype, {
}(),
rotateOnWorldAxis: function () {
// rotate object on axis in world space
// axis is assumed to be normalized
// method assumes no rotated parent
var q1 = new Quaternion();
return function rotateOnWorldAxis(axis, angle) {
q1.setFromAxisAngle(axis, angle);
this.quaternion.premultiply(q1);
return this;
};
}(),
rotateX: function () {
var v1 = new Vector3( 1, 0, 0 );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册