So i made a script to control my Sphere Player but whenever it is in action, the Player becomes slow and barely moves at all
void Update()
{
if (Input.GetMouseButton(0))
{
if (Player.transform.position.x < 0)
return;
if (Player.transform.position.x > 20)
return;
if (PlayerPrefs.GetInt("X") == 1)
return;
d = Input.mousePosition.x;
o = ((20 * d) / Screen.width);
Player.transform.position = Vector3.Lerp(Player.transform.position, new Vector3(o, Player.transform.position.y, Player.transform.position.z), Mathf.SmoothStep(0f, 1f, 0.2f));
}
}
I don’t know whats wrong with it, Can anybody help?