-
Notifications
You must be signed in to change notification settings - Fork 96
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
[Question] How to keep manual drag rotation on touchend? #10
Comments
Hello, this problem can you solve it, can you give suggestions? thanks |
Because I had some urgency I gave up on threeVR, and used the standard DeviceOrientationControls.js from ThreeJS adding a button to switch mode to orbitControls. Not the best UX but it was what I could do at the moment. I think it's only a matter of understanding the math though, quaternions are not for the uninitiated... |
@Carolinex thanks! I try to solve this problem,i find that updateDevice and updateManual functions are modified camera quaternion, i want to handle quaternion,use slerp, but updateDevice is failured,@richtr ,can you give suggestions? thanks.... |
+1 for this |
+1 Anyone got something close? |
Hello,
I hope it is ok to post a question here.
In my application, I need to keep the rotation around Y axis when the user drags manually and releases on mobile, but I'm having problems understanding how to add the rotation difference using quaternions.
If I edit the updateDeviceMove on DeviceOrientationController.js to add the code below, it almost works... for vertical axis, but the others are messed up.
// this variable is a boolean flag set to true on touchend
if( manuallyMoved) {
objY = rotation.setFromQuaternion( objQuat, 'YXZ' ).y;
realY = rotation.setFromQuaternion( deviceQuat, 'YXZ' ).y;
manQuat = new THREE.Quaternion().setFromAxisAngle( new THREE.Vector3(0,1,0), (objY - realY) );
deviceQuat.multiply( manQuat );
manuallyMoved = false;
}else{
deviceQuat.multiply( manQuat );
this.object.quaternion.slerp( deviceQuat, 0.07 );
}
//this.object.quaternion.slerp( deviceQuat, 0.07 ); // smoothing
//this.object.quaternion.copy( deviceQuat );
I put together a very basic example for testing. It's here:
http://ec2-54-207-23-212.sa-east-1.compute.amazonaws.com/tests/360/
Can somebody point me in the right direction?
Thanks.
The text was updated successfully, but these errors were encountered: