Hello
I have a simple script that is supposed to move a GameObject to a certain point and look down on that point from above.
My script is partially working; the GameObject is moving to the correct point but its not looking down from above. So the rotation is wrong. The GameObject flips upside down.
Can you help me get my GameObject to look straight down?
public class MoveTo : MonoBehaviour {
private Vector3 targetPosition = new Vector3(5, 10, 5);
private Quaternion targetRotation = new Quaternion(90, 0, 0, 0);
private float speed = 6f;
void LateUpdate () {
transform.position = Vector3.MoveTowards(transform.position, targetPosition, Time.deltaTime * speed);
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * speed);
}
}