Browse Source

Revert changes for Object3D

Johannes Deml 6 years ago
parent
commit
4d912894d7
1 changed files with 16 additions and 9 deletions
  1. 16 9
      src/core/Object3D.js

+ 16 - 9
src/core/Object3D.js

@@ -277,13 +277,14 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		// This method does not support objects having non-uniformly-scaled parent(s)
 
-		if ( _quaternion === undefined ) _quaternion = new Quaternion();
+		if ( _position === undefined ) {
 
-		if ( _m1 === undefined ) _m1 = new Matrix4();
-
-		if ( _target === undefined ) _target = new Vector3();
+			_q1 = new Quaternion();
+			_m1 = new Matrix4();
+			_target = new Vector3();
+			_position = new Vector3();
 
-		if ( _position === undefined ) _position = new Vector3();
+		}
 
 		if ( x.isVector3 ) {
 
@@ -474,9 +475,12 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 	getWorldQuaternion: function ( target ) {
 
-		if ( _position === undefined ) _position = new Vector3();
+		if ( _scale === undefined ) {
 
-		if ( _scale === undefined ) _scale = new Vector3();
+			_position = new Vector3();
+			_scale = new Vector3();
+
+		}
 
 		if ( target === undefined ) {
 
@@ -495,9 +499,12 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 	getWorldScale: function ( target ) {
 
-		if ( _position === undefined ) _position = new Vector3();
+		if ( _quaternion === undefined ) {
+
+			_position = new Vector3();
+			_quaternion = new Quaternion();
 
-		if ( _quaternion === undefined ) _quaternion = new Quaternion();
+		}
 
 		if ( target === undefined ) {