- Home /
How do I make my player controls more immediate?
I built the breakout game in the Tutorials on this site, but my paddle takes almost a second to respond to player inputs. I've bumped the control Gravity and Sensitivity to 100000 each, I've made all unnecessary objects inactive, and tried adding impulse to the paddle, but nothing seems to help. Paddle scripting included below. Please help!
using UnityEngine;
using System.Collections;
public class Paddle : MonoBehaviour {
public float paddleSpeed = 1f;
private Vector3 playerPos = new Vector3 (1.34f, -3f, 0);
// Update is called once per frame
void Update () {
float xPos = transform.position.x + (Input.GetAxis ("Horizontal") * paddleSpeed);
playerPos = new Vector3 (Mathf.Clamp (xPos, -7f, 10f), -3f, 0);
transform.position = playerPos;
}
}
Answer by allenallenallen · Jul 30, 2015 at 01:10 PM
Try: http://docs.unity3d.com/ScriptReference/Input.GetAxisRaw.html
Input.GetAxisRaw ("Horizontal") * paddleSpeed
So that the slower speed when the joystick or button is just starting to slide or press, which gives the slower speed in the beginning, is now ignored.
Thanks for the suggestion! I actually tried that already too, just forgot to mention it. Been battling this one for a couple of days. It isn't so much that it takes a long time to reach top speed, it's that it doesn't move at all for almost a second.