Pivot3DUtils.setPositionWithReference smoothing causes incorrect rotation
I am currently working on a 3D wayfinding solution with Flare3D and I am working on creating an orbital camera to revolve around the zf3d map. I decided to use the Pivot3DUtils functions to get the camera to orbit the map while always looking at an invisible sphere I placed at the center of the map. However, I am having problems getting the camera animation correct while using smoothing.
When using Pivot3DUtils.setPositionWithReference for positioning of the camera based on an sphere (camera target) and then continuously add to the rotateY the camera target in the update function, the camera rotates correctly but also does a slight zoom in on the scene while animating and after finishing the animation, it zooms out.
Pivot3DUtils.setPositionWithReference( scene.camera, cameraXDistance, cameraYDistance, cameraZDistance, cameraSphere, 0.025 );
Pivot3DUtils.lookAtWithReference( scene.camera, 0, 0, 0, cameraSphere, cameraSphere.getUp() );
cameraSphere.setRotation(totalRotateX, totalRotateY, 0);
If the camera Target is first rotated once on the X axis and then continuously rotated on the Y axis, the camera both zooms in and does a slight rotation on the X during the animation and then rotates back and zooms out at the end. If I give the Pivot3DUtils.lookAtWithReference the same smoothing value as the setPositionWithReference, the X rotation stops but the zoom still occurs.
This behaviour only happens when using smoothing. If I give a smoothing value of 1, the problem does not occur.
Is there any explanation for this erratic behaviour or a way I can use to fix it without giving up smoothing?
Attached are two test files for the Simple case with no X rotation and the more advanced one with X rotation
Thank you for your help
Click Here to Expand Forum to Full Width