- Home /
Question by
JoshBaz · Feb 13, 2016 at 11:20 PM ·
touchcamera-movementclick and drag
Touch/Swipe Input with mouse/touchscreen
Hello. I was making a script to make a camera rotate around a target based on swipe, like on Asphalt 8. I'm using Input.Touch together with transform.RotateAround(). However I ran into a roadblock since the mouse on PC doesn't count as a touch apparently. Now I have no way to test my code. UnityRemote is not an option for me. I want a way to click and drag with my mouse to make the camera rotate around the target and keep looking at the target. Thanks.
Comment
Best Answer
Answer by tanoshimi · Feb 13, 2016 at 11:52 PM
Use Input.mousePosition instead of Input.touches[0].position, and Input.GetMouseButtonDown /Input.GetMouseButtonUp instead of Input.touches[0].phase = TouchPhase.Began and TouchPhase.Ended, respectively.