I’ve just finished the Breakout Game tutorial and I want to move my paddle object with both keyboard and mouse. I want the player to choose which one he/she wants.
public float paddleSpeed = 1f;
private Vector3 playerPos = new Vector3 (0, -9.9f, 0);
// Update is called once per frame
void Update () {
float xPos = transform.position.x + (Input.GetAxis ("Mouse X") * paddleSpeed);
playerPos = new Vector3 (Mathf.Clamp (xPos, -7.5f, 7.5f), -9.9f, 0f);
transform.position = playerPos;
}
}
I’ve discovered how to move with my mouse but how can I add ‘Input.GetAxis (“Horizontal”)’ into the script? And how can I hide my mouse pointer?