WebXR AR set camera start position

Hi everyone! this is my first topic in this forum and excuse me if my english is not the best .

My question is: How i can modify camera start position once i created augmented reality scene. I read that its posible with “xr.baseExperience.camera.position = new position”, (being xr scene.createDefaultXRExperienceAsync…) but it does do anything, maybe because the timing when i call this sentence is not the correct?

Here is my playground of the scene: = https://playground.babylonjs.com/#QWJAH0#7 (The part of the AR is on the bottom of the code, you can ignore the rest of the code).

Im trying to see the scene with my mobile phone, and the scene is displayed correctly but the camera always start above of the car and i want to be more far of the car when AR scenes initiliaze.

Thanks everyone! and excuse me if my english was confusing.

You can set the position in the first frame. you can use

xr.baseExperience.sessionManager.onXRFrameObservable.addOnce(() => {
// here
})

But I have to ask a question for me to understand - what is the point of setting a position of the scene in AR? what is your point of reference?

1 Like

Wow it works!. Thank you very much!

Answering to your question: My idea is to visualize the car in the street like: “How would see this car in the street?”, and then project “a realistic car” with the camera for a more realistic display. So i thought that it would be better to show the car at least in front you, than being above the car at the start of the AR experience.

1 Like

I would recommend to move the model towards you and not set the camera’s position, but both should work the same :slight_smile:

I had thought about that too, but for now it works as expected, thanks again!

1 Like