MouseOrbit resetting position

Hi,
I am using MouseOrbit script for Orbitting camera in Android device to rotate the camera around cue ball in snooker. It works nice in PC builds, but when I deploy it on Android device, it takes input on touch instead of mouse movement(obviously there’s no mouse). I’ve no problem in that.
But when I am done with change of direction and want to fine tune the movement and touch again, the camera resets to default position and I’ve to do the movement again. That’s annoying for a user. I’ve tried everything I could. Can you suggest something which I should try to save the position and start from there only?

PS: My custom mouse orbit script is here.

Edit:

I’ve tried changing one line from this:

var rotation = Quaternion.Euler(y, x, 0);

to this

var rotation = Quaternion.Euler(y, x, 0)*target.rotation;

and it almost worked, now it’s resetting at different rotation angle. But still the problem is same.

[This question][1] is almost similar to my problem. [1]: http://answers.unity3d.com/questions/249222/mouse-orbit-changes-camera-position.html

1 Answer

1

I’ve managed to solve this problem by deactivating the first touch. I am deactivating the first touch and save the touch position, and if the touch position changes, than the mouseorbit gets activated. Using this the problem gets sorted out.

Let me know if any of you needs the exact code.

Hi @Creator347, If you would be so kind as to post the code that worked that would be great! I have been looking for a working swipe to orbit camera for touch screen and have not been able to make it work. This may also be due to my very beginner level. Many posts from years ago ask the same question but few if any provide answers which I could get working. Thank you