Hello, I was wondering on how to create a demo experience for the BabylonJS viewer, because many people do not understand right away that this is a 3D viewer and not a picture.
I was thinking of using autoRotationBehavior, but I have a few questions:
1 - is there a way to switch the rotation? We would like to move the model to the left and to the right and then make it spin?
2 - is there a callback on start and on stop. I could use autoRotationBehavior.rotationInProgress in a render loop, but we stop the render loop when we have nothing to render and I would have to artificially create one.
Yes. Switch rotation is possible, like in this example - https://playground.babylonjs.com/#0XSPF6#7 camera0.useAutoRotationBehavior = true; camera0.autoRotationBehavior.idleRotationSpeed *= -3; // negative value camera1.useAutoRotationBehavior = true; camera1.autoRotationBehavior.idleRotationSpeed *= 3;
I am not sure that I completely understand what you’d like to achieve but you may bind any events with useAutoRotationBehavior property.
The camera either rotates or not, depending on useAutoRotationBehavior is true or false.
Simple example is here - Mu-so 2nd Generation 3D
You can turn rotation on/off with button.
If need the code, toggle rotation function starts from line 204. You can use any events here - mouse move, mouse over etc.
Yes, that is why we went with the popup. The only issue is that I need an observer which is attached to the autoRotationBehavior.rotationInProgress so I can use:
if (scene.activeCamera.useAutoRotationBehavior) {
// showTheUi
}
If false, hide the UI.
You would need event listener if user will interact with other HTML elements (for example, when mouse is over UI element - hide UI and stop rotation).