Still a beginner playing around with code. Right now this one:
var offset:float;
function Update () {
if (Input.GetKey("d")){
YMovement(15,.1);
}
if (Input.GetKey("a")){
YMovement(-15,.1);
}
}
function YMovement(b,c) {
transform.position = Vector3(0,Mathf.Lerp(transform.position.y, b, c), 0);
Debug.Log(c);
}
so from looking at the code, I should be able to press d and a and see the box go straight up and down. I get that result, but the box slows down as it gets close to 15/-15 ...can someone explain to me why it's doing that? also, how do I use the lerp function for something like this without having it slow down before stopping.
Thanks!
facepalm thanks
– anon1931117