I am desperatly trying to create an animation for a Free Camera. Setting “target” property does not work properly. The camera directly looks in wrong direction. But using Quaternions the transition is smooth.
Animation.CreateAndStartAnimation("cameraPosition", freeCamera, "target", 30, 60, freeCamera.getFrontPosition(1), tempCamera.getFrontPosition(1))
I am using free camera as start and by creating a temporary camera at final position and target I get the final quaternion. The following code is roughly what I tried:
var start = BABYLON.Quaternion.FromRotationMatrix(freeCamera.getWorldMatrix()) var end = BABYLON.Quaternion.FromRotationMatrix(tempCamera.getWorldMatrix()) tempCamera.dispose() Animation.CreateAndStartAnimation("cameraPosition", freeCamera, "position", 30, 60, fromCamera.globalPosition, position, Animation.ANIMATIONLOOPMODE_CONSTANT); Animation.CreateAndStartAnimation("cameraRotation", freeCamera, "rotation", 30, 60, start.toEulerAngles(), end.toEulerAngles(), Animation.ANIMATIONLOOPMODE_CONSTANT);
However, if I move the free camera around after the first jump. The next transition start from the original position of the free camera. The world matrix does not consider looking around with the Free Camera. How can I get the right matrix from my current view?