Arc Rotate Camera - how to change the rotation direction and speed with "useAutoRotationBehavior"

I have been looking at Camera Behaviors, in particular:

camera.useAutoRotationBehavior = true;

And it works nicely. But how can I change the speed of rotation and the direction?

I’ve looked at a number of playgrounds - but have found nothing about either of those parameters.

Sorry if it is a simple question, but you know me - I’m no coder :upside_down_face:

cheers, gryff :slight_smile:

camera.autoRotationBehavior.idleRotationSpeed = 0.1;

To change direction, just use a negative value instead :slight_smile:

1 Like

@aWeirdo : TY for the post :slight_smile: I actually had figure it out when I found this playground from a post that @sebavan made on the old forum

But before I could update this thread, my two grand kids arrived for a visit. So my afternoon went out the window.!!

But thank you anyway for helping this crap coder

cheers, gryff :slight_smile:

1 Like

Is there a way to change the direction at run time?
I looked at AutoRotationBehavior - Babylon.js Documentation
I don’t know when you would change it though, some global return from idle callback or something.

I’m not sure i understand,

if( condition) {
camera.autoRotationBehavior.idleRotationSpeed = -camera.autoRotationBehavior.idleRotationSpeed
}

What’s a good condition, I guess?

Window focus maybe

If you simply want to change the direction, permanently, at scene creation, adding it after the ‘camera.useAutoRotationBehaviour’ line (without any if statement) should be fine.
Otherwise the “condition” is highly dependent on when you want it to change direction :smile:

Right, I thought I should change it every time it started, so I don’t get dizzy spinning the same direction every time, why I thought the init method or some callback might be helpful.

Ahh ok,
Could do something simple… like pointerDown https://www.babylonjs-playground.com/#6FBD14#190
of course if multiple pointerdown events in a row, even counts of events (2, 4, 6 etc) will cause the direction to switch back to what it was