Hey all, bit of a weird issue here.
I appear to be having an issue tweening a PerspectiveCamera’s y rotation (using tween.js). It works to some degree, but when rotations are between 90deg and 270deg, they appear mirrored and don’t match.
A bit of a background - I’ve designed a level in blender, and import it using GLTFLoader - all working fine. In this blender level, I have a series of cone shapes that define a position and direction for a camera to tween a long and rotate along.
The camera tweens from position to position (works perfectly fine) and simultaneously rotates based on the cones rotations (semi-working).
In the above screenshot, once it gets to the 5th and 6th cone, the rotations are offset. Cone 5’s y rotation is 270deg and Cone 6 is 226deg.
If I output the rotation of the camera after it finished tweening, it is almost 90 degrees offset from the rotation of cone 6.
I did a bit of testing, look at the screenshot below
As you can see, the arrowhelpers I create every update work fine until it hits 90 degrees, and works fine again after 270. You can observe that if the arrow helpers were flipped for those two, the would match the direction of the cone.
If I console log the rotations of the broken cones, they have minus rotations and sometimes up to 360 degrees or more too much. The others are fine and stay in positive values. All cones in blender have positive rotations between 0 and 360, no more or less.
What is causing the camera’s rotation to mess up in that range?
Sadly I’m unable to upload a test build due to NDA any help is very muchly appreciated!
Live example:
http://davidpuetter.com/games/threejs-test/
Click on the game to start the tween. Once it’s done, press Q to view it from overhead. You can see in the top right one, the lines didn’t match.
Code available here:
Sorry for very messy code, this was stripped out of a project thats under NDA.