- Home /
Can't rotate an GameObject...
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!
Did you change anything prior to the point when it stopped working?
i used another fish model, but all options are exactly the same. the old one doesn't work too now...
I have this same issue, and was wondering if you ever managed to solve this? Sorry for the super late comment!
Answer by Fr0sZ · Jun 20, 2011 at 08:40 PM
Check so the object is not static. Static objects cannot move/rotate
Answer by Fr0sZ · Jun 20, 2011 at 12:30 AM
check so you havent lockt any of the xyz axes
thank you for your answer! i have locked nothing, the only way this would work is in the rigidbody right? any other ideas?
Your answer
Follow this Question
Related Questions
Lock rotation axis? 4 Answers
hoe to rotate a AI as a animation 1 Answer
LookAt() and RotateAround() 1 Answer
LookAt once 0 Answers