Animation has unexpected 180degree flip at end

Why does my camera flip at the end of this animation?

Can you send a picture of the flip ? I do not feel like it is flipping ?

In general it could happen when relying on euler angle instead of quaternions.

The longest animation is (5 * frameRate). If you animate from 0 to (5 * frameRate) then the animation stays smooth until the end like below. Before when you were only animating from 0 to (3 * frameRate) then it seems to jump to the end of the animations at that point. I’m not sure why it does that thou instead of just ending with the values at frame (3 * frameRate)… :thinking:

@sebavan shouldn’t the original PG end with the values at frame (3 * frameRate), not the values at (5 * frameRate)? EG if run both PG’s then can see that they end at the same values because it jumps to the last frame at the end of the first PG…

hmm it works like I expect with
value: Math.PI / 2.00001

but not with
value: Math.PI / 2

So its some strange bug?

Might totally indicate the gimbal lock issue we discussed then: Gimbal lock - Wikipedia

And relying on quaternions for the anim might help in this regards.

It works the same rather using Math.PI / 2.00001 or Math.PI / 2. What fixed it was changing the to frame from “3 * frameRate” to “30 * frameRate”. It’s the same fix that I showed earlier when I changed it to “5 * frameRate”…

1 Like

I still see it look at it flips where pi/2


where pi/2.00001 does not flip

I set all the other animations to end at 5*framerate too. Or am I missing something else?

It seems it has something to do with how gimbal lock is dealt with internally. Here is a non animated version. After it loads use the mouse to rotate the camera very slightly and the image will flip. You will see that the camera rotation.x is now slightly off from PI / 2. If you remove the comments from lines 44 and 45 and reset the camera.rotation.x to PI / 2 it flips back until a mouse movement is detected and it flips back and forth.

EDIT I was using Firefox

1 Like

Hmm maybe it’s device specific then because I’m not seeing any flip, I only ever saw the jump to the last frame at the end which was fixed already… So I’ll leave it to those who can reproduce the flipping issue, sorry for the confusion. :slight_smile:

Oh indeed, I am useing firefox here
and indeed I dont see it Chrome now I check it.

poor forgoten firefox users :frowning:

There was a big problem in this camera setup because its up vector was pointing in the same direction as its forward direction, when they’re supposed to be perpendicular to each other:

Manually setting up takes away the flipping on firefox:

1 Like

Hello just checking in if you’d like any more help on this issue. @Dag_Murphy