So I made this script for acceleration:
var speed: 0.3
if(GetDownKey(KeyCode.UpArrow))
{
transform.Translate (speed += 2.0 * Time.deltaTime))
}
Basically I want the transform.Translate bit to stop once the speed reaches 153.6. How do I do this?
So I made this script for acceleration:
var speed: 0.3
if(GetDownKey(KeyCode.UpArrow))
{
transform.Translate (speed += 2.0 * Time.deltaTime))
}
Basically I want the transform.Translate bit to stop once the speed reaches 153.6. How do I do this?
with an if statement?
if ( speed < 153.6 ) Translate
try this:
if(GetDownKey(KeyCode.UpArrow) && speed < 153.6)