- Home /
Question by
stoniminetar · Oct 03, 2018 at 08:29 PM ·
touchcamera-movementtouch controlsmultitouch
Multitouch problem
Hi, this camera script seems to work only when there are no other touches on the screen. This causes a big problem because I can't move my ball with the UI joystick I have and move the camera around simultaneously.
public class CameraMotor : MonoBehaviour { public Transform lookAt;
private Vector3 desiredPosition;
private Vector3 offset;
private float smoothSpeed = 7.5f;
private float distance = 7.0f;
private float yOffset = 3.0f;
private void Start()
{
offset = new Vector3 (0, yOffset, -1f * distance);
}
private void Update()
{
if (SwipeManager.Instance.IsSwiping (SwipeDirection.Left))
SlideCamera (true);
if (SwipeManager.Instance.IsSwiping (SwipeDirection.Right))
SlideCamera (false);
}
private void FixedUpdate()
{
desiredPosition = lookAt.position + offset;
transform.position = Vector3.Lerp (transform.position, desiredPosition, smoothSpeed * Time.deltaTime);
transform.LookAt (lookAt.position + Vector3.up);
}
public void SlideCamera(bool left)
{
if (left)
offset = Quaternion.Euler (0, 90, 0) * offset;
else
offset = Quaternion.Euler (0, -90, 0) * offset;
}
I've tried a lot of things, but I just can't find a solution. Any help will be appreciated.
Comment
Your answer
Follow this Question
Related Questions
Multi-touch for camera not working? 0 Answers
Multitouch events get stucked. 0 Answers
Help With Multitouch in 2D Windows Store apps 0 Answers
How to get multitouch input using EasyTouch 0 Answers
Simultaneous Multitouch Sends The Touch Over and Over 1 Answer