three-stdlib 2.23.13 → 2.23.14
Sign up to get free protection for your applications and to get access to all the features.
@@ -150,13 +150,16 @@ class OrbitControls extends THREE.EventDispatcher {
|
|
150
150
|
};
|
151
151
|
this.update = (() => {
|
152
152
|
const offset = new THREE.Vector3();
|
153
|
-
const
|
153
|
+
const up = new THREE.Vector3(0, 1, 0);
|
154
|
+
const quat = new THREE.Quaternion().setFromUnitVectors(object.up, up);
|
154
155
|
const quatInverse = quat.clone().invert();
|
155
156
|
const lastPosition = new THREE.Vector3();
|
156
157
|
const lastQuaternion = new THREE.Quaternion();
|
157
158
|
const twoPI = 2 * Math.PI;
|
158
159
|
return function update() {
|
159
160
|
const position = scope.object.position;
|
161
|
+
quat.setFromUnitVectors(object.up, up);
|
162
|
+
quatInverse.copy(quat).invert();
|
160
163
|
offset.copy(position).sub(scope.target);
|
161
164
|
offset.applyQuaternion(quat);
|
162
165
|
spherical.setFromVector3(offset);
|
@@ -148,13 +148,16 @@ class OrbitControls extends EventDispatcher {
|
|
148
148
|
};
|
149
149
|
this.update = (() => {
|
150
150
|
const offset = new Vector3();
|
151
|
-
const
|
151
|
+
const up = new Vector3(0, 1, 0);
|
152
|
+
const quat = new Quaternion().setFromUnitVectors(object.up, up);
|
152
153
|
const quatInverse = quat.clone().invert();
|
153
154
|
const lastPosition = new Vector3();
|
154
155
|
const lastQuaternion = new Quaternion();
|
155
156
|
const twoPI = 2 * Math.PI;
|
156
157
|
return function update() {
|
157
158
|
const position = scope.object.position;
|
159
|
+
quat.setFromUnitVectors(object.up, up);
|
160
|
+
quatInverse.copy(quat).invert();
|
158
161
|
offset.copy(position).sub(scope.target);
|
159
162
|
offset.applyQuaternion(quat);
|
160
163
|
spherical.setFromVector3(offset);
|