Hello,
I can’t get my movement to be framerate independent.
Here’s the code I using inside Update:
void Update ()
{
if (Input.GetKeyDown(KeyCode.Escape))
Application.Quit();
if (Input.anyKey)
{
velx ++;
}
else
{
velx *= drag;
}
velx = Mathf.Clamp(velx, -max_velx, max_velx);
Vector3 delta = new Vector3(velx * Time.deltaTime, 0, 0);
transform.Translate(delta);
}
When I change the quality of the graphics in the game… the player speed changes considirably.
I can’t see where the problem might come from, since I’m scaling the velocity by the time spent on the frame.