on-internet
← Community

Controlling swipe inputs in unity

Stack Overflow ·

I am practicing in Unity; I want to move an object to the right and left according to how I swipe. I have gotten the script so far but the problem occurs when I am playing it. It is setting the objects location to the center; swipe actions are working just fine. However, I don't want it to set the object to the center. Script: public class swipeTest : MonoBehaviour { public SwipeManager swipeControls; public Transform Player; private Vector3 desiredPosition; private void Update() { if (swipeControls.SwipeLeft) desiredPosition += Vector3.left; if (swipeControls.SwipeRight) desiredPosition += Ve

Comments

Sign in or sign up to comment and upvote.

No comments yet.