Hi there. I’m making a game where the character must get to an object, and once they arrive they are teleported back to the start, the object moved, and they are rotated to face the new location of the object.
So I do this using a script attached to the object with the following lines of code:
transform.position = new Vector3(randomX, y, randomZ); // Move object
characterController.Move(new Vector3(startX, y-1, startZ)); // Move character back to start
characterController.transform.LookAt (new Vector3 (transform.position.x, transform.position.y, transform.position.z)); // Look at new location of object
But the LookAt does not work and the characterController does not face the object. If I move the LookAt to Update() then the code works, however I don’t want the LookAt to be called continuously. Can anyone tell me a) why this behaviour is happening or b) how to fix it?
thanks in advance