Hi,
i want to make a GameObject flying around passing some waypoints. On its way it should face the waypoint it its heading to.
This worked fine with this script:
void FixedUpdate()
{
transform.position = Vector3.MoveTowards(transform.position, WP[actPoint].transform.position, speed * 10);
transform.LookAt(WP[actPoint].transform);
if(isNearlyThere()){
actPoint++;
speed = UnityEngine.Random.Range(minSpeed, maxSpeed);
if(actPoint >= WP.Length)
actPoint = 0;
}
}
But suddenly it stopped rotating. I even cant rotate it with for example transform.rotate(0,90,0) - what happened? “WP” is an Array of empty GameObjects which act as waypoints.
Can you help me out?
Thanks!