Is there a way I can Lerp or interpolate this so that the object doesn’t just “transport” to the new location but rather moves smoothly? I can usually fumble my way through JS but I am new to C# and everything I try throws an error. Here is my current code:
void SetTransformY(float n){
transform.position = new Vector3(transform.position.x, n, transform.position.z);
}
// Update is called once per frame
void Update () {
if(NetworkManager.rocketButtonState == 0){
SetTransformY(1.0f);
}
else if(NetworkManager.rocketButtonState == 1){
SetTransformY(0.2f);
}
else if(NetworkManager.rocketButtonState >= 2){
SetTransformY(0.1f);
}
}
thank you