I've made a script to rotate the camera around an object with touch-gesture (iOS):
The camera rotates around the Cube. When I activate one of the two lines separately they work ok.
With only first line active swiping Up-down, rotates the camera around the cube vertically.
With only the second line active swiping left-right, moves the camera around the cube horizontally.
But if I activate them both the movement is not like expected, the camera doesn't keep level with the horizon.Instead it dolly's around. Basically what I'm after is the movement created with the Unity MouseOrbit.js-script (which is only for mouse-movement). But I can't get it working in combination with my script.
Any suggestions? Is it my combining the 2 movements wrong or do I need to build in some sort of restriction? Any advice is greatly appreciated. David
The second parameter of RotateAround is the axis of rotation. Make sure that is always vertical, e.g. instead of camera.transform.right and up, just use Vector3.right and Vector3.up. You may need to clamp one of the values to something (-90,90) to prevent weirdness at the top/bottom.
answered Mar 05 '11 at 12:52 PM
The above does not work for me, try this if you have the same results:
answered Mar 09 at 01:04 AM