Camera Animation bug

Hi guys , I just wanted to point out that some of my projects with babylon that I havent touch had been presenting a bug, so I checked them and it has something to do with animations linked to camera properties like the alpha beta or radius of an arcrotateCamera, so the thing is those projects are linked to your cdn scripts so I guess you guys changed something and that something ended up in this bug. so you see I use this prototype to move the camera angles and radius with an ease animation so it looks smooth :
BABYLON.ArcRotateCamera.prototype.spinTo = function (whichprop, targetval, speed) {
var ease = new BABYLON.CubicEase();
ease.setEasingMode(BABYLON.EasingFunction.EASINGMODE_EASEINOUT);
BABYLON.Animation.CreateAndStartAnimation(β€˜at4’, this, whichprop, speed, 120, this[whichprop], targetval, 0, ease);
}
so before this prototype for the arcrotateCamera worked just fine, it animated the camera from the current coordinate to the desired one, but now is just making up 2 random coordinates and goes from one to the other, so the animation is still being made but the coordinates are being changed to random digits.
So I made a repro of this behaviour , what you will notice in the repro is that the camera starts in some alpha, beta and radius , and 2.5 seconds later the spinTo function starts and it should move to the desired coordinate which is a pretty close coordinate to the starting one but instead of doing this the camera suddenly appears at a different start coordinate and spins to another random coordinate :

So also I wanted to add that I already fixed this error on my projects but what I had to do is load your babylon.js script that I had downloaded like 2 or 3 weeks ago. So I know that this bug is pretty recent. would love if you guys could take a look to that , I mean I already solved the problem for me but there might be people out there that havent been able to do the same or dont even know that there is a bug out there in their projects. @sebavan @shaderbytes @bghgary you guys are always up for some challenge and altruism :slight_smile: thats why you re the best !! ahahaha also dont hesitate to ask for my help , anything I can be of use just say the word. I got the babylon.js that doesnt have the bug just in case you guys wanna compare or smt, so just tell me if you want me to share it! thanks for everything !

Seems the problem is solved here - BABYLON.CubicEase() regression

1 Like

@Evgeni_Popov, it is the second issue in a couple day about it, I wonder if we should move into a new mode instead assuming it is the same root cause ?

Yes, it is the same problem. I’m going to introduce a new mode instead.

2 Likes

O you re rigth thats solved, just gonna leave it out here very explicit for anyone looking for the fix
just needed to replace the 0 for the BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT:

old way(bug on it):
BABYLON.Animation.CreateAndStartAnimation(β€˜at4’, this, whichprop, speed, 120, this[whichprop], targetval, 0, ease);
}
new way (bug fix):
BABYLON.Animation.CreateAndStartAnimation(β€˜at4’, this, whichprop, speed, 120, this[whichprop], targetval, BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT, ease);

Thanks for the help guys!

1 Like

PR:

2 Likes

OMG i just posted about that!

yes thank for posting i was facing the same issue related to spin rotation.

BABYLON.ArcRotateCamera.prototype.cameraSpinRotation = function (
  whichprop,
  targetval,
  speed
) {
  var ease = new BABYLON.CubicEase();
  ease.setEasingMode(BABYLON.EasingFunction.EASINGMODE_EASEINOUT);
  BABYLON.Animation.CreateAndStartAnimation(
    "",
    this,
    whichprop,
    speed,
    120,
    this[whichprop],
    targetval,
    BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT,
    ease,
    function () {
      console.log(
        "I am done with " +
          whichprop +
          ". Its value value is: " +
          camera[whichprop]
      );
    }
  );
};
1 Like