Perfect Camera Rotation Animation

https://www.babylonjs-playground.com/#B2GLWZ#1

the above example is prototype we are working on a project.

when you click on navigation point(arrows) camera rotation and position will be animated.

works fine on initial camera rotation.

some cases (spin camera 3-4 times 360 degrees in one direction) camera rotation y will change above 14 or - 14.

after click on any navigation point its spinning like TOP TOY.

how to calculate nearest Y angle value to animate perfectly.

Thank you

Hi Vijayxd,

I think the issues you were describing are just edge cases with dealing with winding and unwinding over-large Y rotations. I noticed you already had some code in place that seemed to be checking for this issue, so I augmented it slightly to handle a few additional scenarios (prominently negative rotations) on new lines 72 through 82. Is this behavior closer to what you’re going for?

https://www.babylonjs-playground.com/#B2GLWZ#2

Best of luck!

3 Likes

easy & perfect solution