• 3D
  • Tilt camera through 0deg position smoothly with AnimationPlayer

I've got a camera "on rails" defined by a sequence of AnimationPlayer animations and at one point it needs to tilt from looking above the horizon to below the horizon, ie its x rotation passes through 0. And I cannot get it to do this smoothly -- there's always a pause in the animation as it hits 0, even if it's all done in one animation going from a +x keyframe to a -x keyframe. At the moment I'm distracting from the glitch by triggering another action as it hits 0, but any suggestions for a proper solution would be welcome!

(Actually, the camera is the KinematicBody I was trying to animate in https://godotforums.org/discussion/26627/animating-a-physicsbody so it's not directly animated, but its target position and point of focus are, and they're not doing this move smoothly. I'd originally drafted this question before that when I was directly animating the camera, but really all that's changed is the type of node being rotated.)

Can you upload some example code (or better, an example project) here?

I think I've figured it out.

All the relevant behaviour is in an AnimationPlayer, so there's not really any code. So I tried to come up with a minimal example exhibiting the problem, failed create something from scratch, so tried stripping things from the real project to get it down to something small enough to upload. And noticed that at a particular stage in that process it started behaving as I wanted/expected.

What I think what is happening is that as the camera hits horizontal it suddenly gets a lot of terrain meshes in its visibility range (which you don't see popping into existence because of environmental fog). Take the terrain away and it works. Point the camera away from the terrain as it dips below the horizon (I can get away with this because of the fog) and it works. So I have an acceptable work-around.