Reply To: How to change transform.rotation

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

#36649

@jgonzalez  I realized a problem I am running into is that transform.position moves the object in world space rather than local space and I need it to move in local space. I tried fixing this by changing transform.position to transform.forward . Unfortunately rather than making my animal lerp forward, it instantly rotates it 90 degrees counter clockwise. Any idea why this is happening?

IEnumerator RotateObject()
{

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

while (elapsedTime < 5){
elapsedTime += Time.deltaTime;
transform.forward = Vector3.Lerp(beginning, ending, elapsedTime / 5);
Debug.Log(transform.position);
yield return null;
}

}