Skip to content

Commit dc33e1d

Browse files
committed
Corrected Gimbal lock cases in Vector3.setEulerFromRotationMatrix()
1 parent ac3e5e4 commit dc33e1d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/core/Vector3.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ THREE.Vector3.prototype = {
299299

300300
} else {
301301

302-
this.x = Math.atan2( m21, m22 );
302+
this.x = Math.atan2( m32, m22 );
303303
this.z = 0;
304304

305305
}
@@ -332,7 +332,7 @@ THREE.Vector3.prototype = {
332332
} else {
333333

334334
this.y = 0;
335-
this.z = Math.atan2( m13, m11 );
335+
this.z = Math.atan2( m21, m11 );
336336

337337
}
338338

@@ -364,7 +364,7 @@ THREE.Vector3.prototype = {
364364
} else {
365365

366366
this.x = 0;
367-
this.y = Math.atan2( m31, m33 );
367+
this.y = Math.atan2( m13, m33 );
368368

369369
}
370370

@@ -379,7 +379,7 @@ THREE.Vector3.prototype = {
379379

380380
} else {
381381

382-
this.x = Math.atan2( - m13, m33 );
382+
this.x = Math.atan2( - m23, m33 );
383383
this.y = 0;
384384

385385
}

0 commit comments

Comments
 (0)