Skip to content

Commit 972c852

Browse files
committed
Removed Rotation class. Using getters/setters to keep .rotation and .quaternion in sync.
1 parent 9f60c1c commit 972c852

File tree

8 files changed

+355
-359
lines changed

8 files changed

+355
-359
lines changed

examples/js/controls/TransformControls.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,9 @@ THREE.TransformControls = function ( camera, domElement, doc ) {
437437

438438
object.rotation.set( 0, 0, 0 );
439439

440-
if ( name == 'RX' ) object.rotation.setX( Math.atan2( -eye.y, eye.z ) );
441-
if ( name == 'RY' ) object.rotation.setY( Math.atan2( eye.x, eye.z ) );
442-
if ( name == 'RZ' ) object.rotation.setZ( Math.atan2( eye.y, eye.x ) );
440+
if ( name == 'RX' ) object.rotation.x = Math.atan2( -eye.y, eye.z );
441+
if ( name == 'RY' ) object.rotation.y = Math.atan2( eye.x, eye.z );
442+
if ( name == 'RZ' ) object.rotation.z = Math.atan2( eye.y, eye.x );
443443

444444
}
445445

src/core/Object3D.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@ THREE.Object3D = function () {
1717
this.up = new THREE.Vector3( 0, 1, 0 );
1818

1919
this.position = new THREE.Vector3();
20+
this.rotation = new THREE.Euler();
2021
this.quaternion = new THREE.Quaternion();
2122
this.scale = new THREE.Vector3( 1, 1, 1 );
2223

23-
// for backwards compatibility (maps changes to this.rotation onto this.quaternion)
24-
this.rotation = new THREE.Rotation( this.quaternion );
24+
// keep rotation and quaternion in sync
25+
26+
this.rotation._quaternion = this.quaternion;
27+
this.quaternion._euler = this.rotation;
2528

2629
this.renderDepth = null;
2730

src/loaders/ObjectLoader.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,6 @@ THREE.ObjectLoader.prototype = {
265265
matrix.fromArray( data.matrix );
266266
matrix.decompose( object.position, object.quaternion, object.scale );
267267

268-
object.rotation.updateEuler();
269-
270268
} else {
271269

272270
if ( data.position !== undefined ) object.position.fromArray( data.position );

0 commit comments

Comments
 (0)