I’m new to Unity I’m making a pong game and trying to get the paddle to go up and down through touch.
This is what i have for the movement right now, but this is just keyboard, I’m not sure where to start building on touch, no tuts i’ve seen are updated enough, are there trying to do way to much and i can’t get them to work in my game.
I just need the paddle to go up and down through touch…
public float paddleSpeed = 1;
public Vector3 playerPos;
private Vector2 touchOrigin = -Vector2.one;
// Update is called once per frame
void Update()
{
float yPos = gameObject.transform.position.y + (Input.GetAxis(“Vertical”) * paddleSpeed);
playerPos = new Vector3(-10, Mathf.Clamp(yPos, -18f, 10f), 0);
gameObject.transform.position = playerPos;
}