- Home /
Drag Rotation Objet Snapping to 0,0,0 on new drag.
I am using the following code to update an object's rotation while dragging using HoloLens. This is called in a function once per frame while the user is dragging:
transform.localRotation = Quaternion.Euler (transform.localRotation.x + 90f + cameraRelative.y * 1000f, transform.localRotation.y + 90f - cameraRelative.x * 1000f, transform.localRotation.z);
This works great, however, when the user lets go, then clicks and starts dragging again, the object will snap back to 0,0,0 rotation and dragon from there, rather than picking up where it left off - this is more than a bit perplexing to me. Any insight will help. Thanks!
(Note not all the x and y offsets match; the object in question's mesh and containing object don't align exactly, but it does drag rotate as expected until it snaps back to 0,0,0).
Your answer
Follow this Question
Related Questions
Rotating a gameobject via dragging finger 1 Answer
When applying a 90 degree rotation to Euler Angles, it is over/undershooting sometimes.. 2 Answers
How do I rotate an object when I press down a key and then it rotates back when I release the key 0 Answers
Quaternion, eulerAngles, localEulerAngles Driving me mad 1 Answer
fixed rotation around object 1 Answer