Why my Ship flies out of its designed route when Play?

I met a strange situation. When I play, my ship bit by bit flies out of its designed route. But it can keep its route in the Timeline play. Anyone know how it could become like this?

Hi,

First of all, check the timeline animation. The Player Ship (= the child of the Player Rig) must not be animated. Only the Player Rig may be animated.

The Player Ship may be moved via code. If you are getting unexpected results near the boundaries of your screen, check the values you are using in Mathf.Clamp.

The Camera must neither be animated nor moved via code.

Did this help you fix the problem?


See also:

I animated Player Rig, not Player Ship.

The Ship flies out of route by itself. I am not controlling it at all. So it should not be the Mathf.Clamp values issue.

The Camera is not animated; nor it is moved via code.

Does that mean there is no script attached to the ship? If there is a script, disable it to see if the issue persists.

Thanks very much for the help. There are two scripts attached to the ship (Player Controls and Collision Handler). Your method works. By disabling the “Player Controls” script, I find out the problem. I notice my Ship’s route would be slightly affected by its collision with things such as trees, probably because the “Collision Handler” script is still working.

You’re welcome. :slight_smile:

Unity is fairly complex. Sometimes, it is very difficult to tell what might be causing the problem. In those cases, disabling certain things can help you narrow it down.

Is the problem solved now? :slight_smile:

Very good advice! Yes, the problem is solved.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms