I have a model of a dragon, with an animation of it flying. When I play the animation in the Animator's preview, the dragon flies in a straight line, but when I run it in-game, it flies around in circles about 10 units in diameter.

If the turning isn't coming from the animator, it has to be coming from somewhere else, but I have no idea where. There aren't any scripts on the dragon that would influence it like that. Is there any way to discover what's causing my dragon to turn? (It's times like this that I really miss the ability to set a memory breakpoint on an object when working in .NET. That would make this trivial!)

  • \$\begingroup\$ Does this happen in an empty scene, containing nothing but the dragon? When there's no rigidbody on the dragon? If so, it's probably coming from the animation after all - if the final frame of the animation is rotated just a tiny bit relative to the first frame, that rotation will add into the next cycle, then 2x that rotation into the cycle after that, snowballing until what looks like a straight-line animation eventually bends around in a circle. \$\endgroup\$
    – DMGregory
    Commented May 31, 2020 at 21:41
  • \$\begingroup\$ @DMGregory This isn't that; it's a pretty tight, smooth circle where the dragon is continuously turning. Definitely tight enough that it would be readily apparent in the animator! \$\endgroup\$ Commented May 31, 2020 at 22:04
  • \$\begingroup\$ And the answers to the first two questions I asked are? \$\endgroup\$
    – DMGregory
    Commented May 31, 2020 at 22:10
  • 1
    \$\begingroup\$ @DMGregory Ah yes, the old StackOverflow cliche: "all you have to do is reduce your massively complicated system with thousands of moving parts to a MVCE." The poster child for SE's perceived cultural hostility. Can we please stop with the insulting of my intelligence and proceed under the assumption that I am an experienced, competent developer who is familiar with all of the obvious stuff like this, and if it were at all feasible to do it that way, I would have already done it and would not have needed to ask about it on here? Please? \$\endgroup\$ Commented May 31, 2020 at 23:24
  • 2
    \$\begingroup\$ Please assume good faith. Folks here are volunteering their time to help you. Since we don't have your whole project in front of us, we need your collaboration to narrow down the source of the problem. If your game is so varied and complex that breaking it down piece-by-piece is a daunting prospect, consider just how much more difficult it is to narrow down the problem with only a 2-paragraph description to go from. To get you good answers quickly, we'll need your help in reducing the set of potential contributing factors to a scope we can see & examine in your question. \$\endgroup\$
    – DMGregory
    Commented May 31, 2020 at 23:29

2 Answers 2


After a bunch of poking around, I was finally able to get it to stop by disabling the NavMeshAgent on the dragon, which was used to make it take a running start before taking off and flying. Once I knew what to look for, a bit of Googling shows that NavMeshAgent making things circle the destination is a known issue that's been around for years.

The best solution appears to be to set agent.isStopped = true when taking off.

  • 1
    \$\begingroup\$ Great find! Thanks for sharing your solution. \$\endgroup\$
    – DMGregory
    Commented Jun 2, 2020 at 21:19
  • \$\begingroup\$ @DMGregory Yeah, this was annoying enough to track down that I figured I may as well save the next guy to hit this problem the trouble. (Especially as the next guy may well be me a year from now when I've forgotten the details!) :P \$\endgroup\$ Commented Jun 2, 2020 at 21:50

Here's the possible reasons, keep in mind this is speculation since I don't know what you are actually doing. These are things I would check if I was you.

Animation might have unwanted rotations.
Solution: Check your animation in 3D software or preview window in inspector.

There's an undesired physics pull from other objects.
Solution: Are there any scripts in the world that effects your dragon without you knowing? Maybe a layer specific effect or just using Find().

Your bones might have rigidbodies on them.
Solution: Maybe you added ragdoll then forgot about it. Check bones for rigidbodies.

Is your model centered correctly?
Solution: Go back to 3D software and apply all transforms as well as centering your mesh to world.

Is there a physics force applied in 3D software?
Solution: Maybe you exported a physics effect by mistake? Check if you used a physics simulator on your 3D software such as wind. This is very low probability but hey, people do win lottery.

Your model have orientation problems with it's parents.
Solution: Check the origin of your parents and try to fix it that way. Is your object properly centered with it's parent's origin?

Your animation has a problem you couldn't detect.
Solution: Disable said animation and check movement in-game.

It's something else. Welcome to Quaternion hell.
Solution: Setup breakpoints at rotations in code, set up Debug.Logs on your rotations and try to understand your rotations and where it gets bad.
I did use this one to fix bad rotation before. It ain't pretty.

  • 1
    \$\begingroup\$ I'd add to this to try zeroing the angular velocity on the Rigidbody every fixed step / in every OnCollisionEnter/Stay. If that solves or reduces the problem then you know something has given the RB an angular kick somewhere, and you can then hunt down potential collisions or AddTorque/AddForceAtPoint calls that could contribute to it. \$\endgroup\$
    – DMGregory
    Commented Jun 1, 2020 at 13:10
  • \$\begingroup\$ Oh yeah, and I forgot another one. The parenting coming from the 3D application can mess rotation. I did encounter this one. Solution: Try to get a good comprehensive parenting inside the 3D software. \$\endgroup\$ Commented Jun 1, 2020 at 14:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .