expo-three-orbit-controls icon indicating copy to clipboard operation
expo-three-orbit-controls copied to clipboard

Fix deprecated method name in latest versions of THREE

Open markrickert opened this issue 1 year ago • 3 comments

I’m using the latest version of THREE in my branch (pr coming soon to expo-three) and this was required to get the orbit controls working since Quaternion.invert() was changed to Quaternion.inverse() in version 0.142.0.

If anyone else needs it, here's the patch:

expo-three-orbit-controls+2.0.0.patch:

diff --git a/node_modules/expo-three-orbit-controls/build/OrbitControls.js b/node_modules/expo-three-orbit-controls/build/OrbitControls.js
index 5540eb2..7bd2d6d 100644
--- a/node_modules/expo-three-orbit-controls/build/OrbitControls.js
+++ b/node_modules/expo-three-orbit-controls/build/OrbitControls.js
@@ -631,7 +631,8 @@ export class OrbitControls extends EventDispatcher {
             const offset = new Vector3();
             // so camera.up is the orbit axis
             const quat = new Quaternion().setFromUnitVectors(this.object.up, new Vector3(0, 1, 0));
-            const quatInverse = quat.clone().inverse();
+            // This patch fixes a deprecated method name in the latest version of THREE
+            const quatInverse = quat.clone().invert();
             const lastPosition = new Vector3();
             const lastQuaternion = new Quaternion();
             return () => {

markrickert avatar Mar 18 '24 23:03 markrickert

Other than this, this orbit control worked really well!

markrickert avatar Mar 19 '24 15:03 markrickert

@EvanBacon The threejs upgrade to expo-three has landed so anyone upgrading past [email protected] will need this patch to use this library now.

markrickert avatar Jul 31 '24 16:07 markrickert

I used these code to Temporary repair this Quaternion.prototype.inverse = function () { return this.invert() }

Bosconovitchi avatar Aug 01 '24 03:08 Bosconovitchi