Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecated method name in latest versions of THREE #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

markrickert
Copy link

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 () => {

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
@markrickert
Copy link
Author

Other than this, this orbit control worked really well!

@markrickert
Copy link
Author

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

@Bosconovitchi
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants