How can I set the camera position in Blender, specifically to match the x, y, z coordinates provided by Babylon.js

I’ve a specific scene being utilized in Babylon.js with a FreeCamera positioned at a particular location. I aim to extract the coordinates (x, y, z) from Babylon.js and integrate them into Blender. This way, I can replicate the existing view from Babylon.js within my Blender environment.

cc @PirateJC

In blender, you can use to get the current camera.

Then use camera.localtion[0] = x or camera.location = [x,y,z] to modify the camera position.

In the simple case I think the babylon.js vector to blender conversion can be done by swapping the y and z axes.

Here is a simple example. After execution the camera should move above the origin.

import bpy

def vec_from_bjs(bjs_vec: list[float]):
    result = [0., 0., 0.]
    result[0] = bjs_vec[0]
    result[1] = bjs_vec[2]
    result[2] = bjs_vec[1]
    return result

camera =

camera.location = vec_from_bjs([0, 5, 0])


What should be done for the camera rotation?

If you’re using Euler angles you should still be able to swap the two axes the same way, but I’m not sure if the rotation order will have any effect.

Or you could consider using camera direction instead of rotation.