ArcRotate Camera Autorotate Keeps Speeding Up

I have been trying to hunt down a arcRotateCamera issue, but I am at a bit of a loss.

I have an issue where an arcRotateCam behavior will keep getting scaled more and more in the following way every time updateCamera (from the linked class below) is called:

  • increasing in idleRotationSpeed - it wants to spin faster and faster
  • decreasing in its idleRotationWaitTime - it waits less and less time before spinning up
  • decreasing its idleRotationSpinupTime - it will keep spinning up quicker and quicker

My code is spread over too many lines and classes to playground. It would take a week for you to dig through. So, at this point ** I am just looking for general advice on what common points that would link those properties (some sort of mega variable that messes with them all), or other types of things that may magnify all arcrotate camera behavior properties given I don’t actually ever change those variables in my code.**

This is the camera class… https://playground.babylonjs.com/#E6C9NY#3 but I just don’t see how this is modifying the camera’s ArcRotate behavior like it seems to be doing.

Any thoughts would be appreciated. I am sure its something simple that I am overlooking

Could you console these values?
There is some camera animations in your class which changes camera values.
Also, you may try to define the values of these properties at the end of each updateCamera function call and see what will happen.
Moreover, you may try to disable autorotation and see if there are some camera moves without it.

@Calsa Thought I’d give some follow up and check how you are doing with your issue? :slight_smile:

I spent some time today to dive deep and learn about this particular camera behavior and here is what I learned.

I started with a simple playground and used the inspector to play around with values. https://playground.babylonjs.com/#6FBD14#1614
This was to see what other factors could be affecting idleRotationSpeed , idleRotationWaitTime , and idleRotationSpinupTime. I noticed a couple of things.

Changing values like Beta, target, radius and FoV did not affect these values. However if you are editing the inertia or alpha that may affecting stuff. The autorotate mode will only happen when there is no input . Double check you are not doing this by accident.

For debugging your specific code piece I would recommend lots of console.log statements throughout your code, like labris suggested. This might help isolate the line of code that is changing something. Another suggestion you can also try is debugging locally with VS code and be able to set break points and step through the source code. Finally another trick is to manually set these variables in the render update function like so.

scene.onBeforeRenderObservable.add(() => {
      camera.autoRotationBehavior.idleRotationSpeed = 1;
      // add more here...
});

In theory this should always set them back to where they are supposed to be.

Let us know how its going so we can give more help if you need. :slight_smile:

1 Like

Hi @Calsa just checking in, do you need any more help? :slight_smile: