Hello,
I’m exporting simple scene with 1 mesh and camera to .babylon file.
View from Blender camera is rotated in different way than in sandbox https://sandbox.babylonjs.com/
Probably going to depend on the camera type being exported as. Was always tricky to arcrotate camera to match up, but you can easily adjust. What type are you exporting as?
I looked at this, this morning for a while, but no easy changes. This was put in before me, and then edited by someone else later to handle being in quaternion mode.
The one thing I did was the arc rotate camera export, which basically side steps angles, if that type of camera is acceptable, it seems to work. If so, change to arc camera in the exporter section of Camera data properties. Then add a Track To modifier, selecting the target. This is only used by the exporter to get the mesh. All the other settings are not consulted by the exporter, so unless you actually want to do this in Blender, I do not think changing them make any difference.
The sandbox will usually be “backward” compared to how it will look in your scene. I believe it’s due to the camera targeting the center of the mesh which makes the camera rotate. It took me a while to figure it out, but in Blender this is how you should be setting up your objects:
If you’re looking “forward” the x-axis (red arrow) should be pointing to the left, and the y-axis should be pointing towards you. When you export you should have these settings as default when exporting a gltf/glb:
Note the “+Y Up”. I believe with that enabled what ends up happening is that the Z-axis ends up rotating forward and the Y-axis now points up. If you used this cube as is in the Sandbox this is how it would appear:
@sebavan I don’t think @jgonzosan is saying anything is wrong with the glTF. I think @jgonzosan is saying that the glTF is being exported correctly while the Babylon export is not.
I don’t usually use the camera from the exported models. Typically I’ll create a camera in BabylonJS directly. I also don’t use the Babylon exporter for Blender, I just export as a gltf/glb file. I’m sure some of these issues with orientation could be fixed if you exported out the camera within Blender then using that as the camera in Babylon.
I’ve attached the same blend file with the camera in Blender renamed to “BlenderCamera”. I also included a glb file with just the cube exported out and another with everything including the camera. You can switch the cameras used in the Sandbox when clicking the camera icon at the bottom right of the window.
Just confirming, you have a camera on Blender looking down a fixed direction, and you want to export it to .babylon, load it and have it be the same as the direction on Blender?