|
@@ -340,9 +340,19 @@ Object.assign( Matrix4.prototype, {
|
|
|
|
|
|
if ( x.lengthSq() === 0 ) {
|
|
if ( x.lengthSq() === 0 ) {
|
|
|
|
|
|
- // eye and target are in the same vertical
|
|
|
|
|
|
+ // up and z are parallel
|
|
|
|
|
|
- z.z += 0.0001;
|
|
|
|
|
|
+ if ( Math.abs( up.z ) === 1 ) {
|
|
|
|
+
|
|
|
|
+ z.x += 0.0001;
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ z.z += 0.0001;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ z.normalize();
|
|
x.crossVectors( up, z );
|
|
x.crossVectors( up, z );
|
|
|
|
|
|
}
|
|
}
|