Can't change camera properties when importing glTF

Hi there !

I’m trying to play around with the ArcRotateCamera, but I can’t get to change its properties when I’m loading models from a glTF scene.

As you can see in this PG ( at line 9, I’m trying to change its position without any success.

Any ideas why ?

Thanks !

Hi V! Welcome to the BabylonJS forum.

Line 18 scene.createDefaultCameraOrLight(true);

I think that line installs a NEW scene.activeCamera, so your camera adjustments must happen AFTER that line. Seems to work.

You could also remove lines 17/18, and then do your camera work “up-north” again…

I up-scaled that model 350%… it was a little small. I hope this helps… party on!

Oh, okay, thanks ! I’m kind of a new to babylonJS, thanks for the help !

By the way, I have one more question with ArcRotateCamera, is it possible to have the lower radius limit to be set automatically as it is done in the babylon.JS Sandbox, so that we can’t zoom into the model ?

Hey and welcome
for your question, you want to use the framing behavior: Apply Camera Behaviors - Babylon.js Documentation

The problem is, I don’t have only one mesh, my model is divided in several meshes, so I can’t use one as the main target. Or can the root be used in this case as the target for the ArcRotateCamera ?

it could be a root or a new dummy box that you create and which contains (visually) the meshes you want to “protect”