Arc Rotate Camera not rotating

I have tried to make the camera auto-rotate but could not seem to get it.
My code goes like this (I used Camera Behaviors to try to make this happen):

let camera = new BABYLON.ArcRotateCamera("Camera", -Math.PI / 5, 1, 4, new BABYLON.Vector3.Zero(), scene);
camera.attachControl(canvas, true);

camera.lowerRadiusLimit = 10;
camera.upperRadiusLimit = 18;
camera.idleRotationSpeed = 2;
camera.idleRotationWaitTime = 1;
camera.idleRotationSpinupTime = 3000;
camera.useAutoRotationBehavior = true;

The camera is not moving and I’ve been unable to find the way to make it work, would love some help!

works fine in the PG Babylon.js Playground
can you repro?

3 Likes

Welcome to the forum @kengru!

Looks like your code runs as expected in @aWeirdo’s playground, did you setup your scene’s active camera to be the ArcRotate camera you created with the behaviors?

@aWeirdo, I see that it’s working on the PG, but for some reason it’s not working on my instance.

@Drigax, yes I did

I inserted my code in the playground and it’s working alright… Seems like I have to do some debugging. Thank you very much for the help.

Quick question, how can I upload a texture to the PG? Can’t seem to find the tool for it, if it exists.

1 Like

Hi. Do not forget to add render function to your code

engine.runRenderLoop(function () {
  scene.render()
})

This is what pg has internally :yum:

1 Like