diff --git a/docs/api/core/Object3D.html b/docs/api/core/Object3D.html index 814a95c7df68000ecc1b02883f5eb154a519369c..27d3cd7744cf4500dcd3e6ac29e0cb9127b574a9 100644 --- a/docs/api/core/Object3D.html +++ b/docs/api/core/Object3D.html @@ -320,6 +320,15 @@ Rotate an object along an axis in object space. The axis is assumed to be normalized. +

[method:Object3D rotateOnWorldAxis]( [page:Vector3 axis], [page:Float angle] )

+
+ axis -- A normalized vector in world space.
+ angle -- The angle in radians.

+ + Rotate an object along an axis in world space. The axis is assumed to be normalized. + Method Assumes no rotated parent. +
+

[method:null rotateX]( [page:Float rad] )

rad - the angle to rotate in radians.

diff --git a/src/core/Object3D.js b/src/core/Object3D.js index 318bd23426deeb1cdc829be324ac794adaa2abc0..6d508d1074fe1fd5f7eb403d314a605d507b5acf 100644 --- a/src/core/Object3D.js +++ b/src/core/Object3D.js @@ -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 );