Reply To: How to change transform.rotation

Forum Archive How to change transform.rotation Reply To: How to change transform.rotation

#36645

@jgonzalez  I tried using the below code to Lerp an object along an axis. It is basically identical to the Lerp you used for the rotation but it is making the object teleport like before. Do you know what mistake I am making? For context, this is a co routine that has been called and the variables inside it were declared at the top.

{

beginning = transform.position;
ending = transform.position;
ending.x += -1f;

while (elapsedTime < 5){
elapsedTime += Time.deltaTime;
transform.position = Vector3.Lerp(beginning, ending, elapsedTime/5);
}

}