Camera gizmo blender-like

Here’s a demo of blender’s camera gizmo working in babylonjs, you can click on the axis to switch between different perspectives

original threejs version : GitHub - jrj2211/three-orientation-gizmo: Creates an orientation gizmo (similar to a view cube) to show the orientation of the camera's rotation. The user can click on each axis and the camera will rotate to face that direction. It is styled similar to Blender's orientation gizmo.

9 Likes

@waverider404 This is great !!! @PatrickRyan, @Cedric @PirateJC what do you think of having the helper in our standard code ?

2 Likes

I’ve been wanting to add this feature for a very long time. So happy to see it happening!

2 Likes

thanks : ) @sebavan

added animation too

2 Likes

@sebavan, I think a helper in the code is fine. The challenge with the difference between the camera models in Babylon and Blender is that Blender’s main camera is an editor camera for creating your scene and while you can render from the edit camera you typically will set up a rendering camera so you can be editing with the edit camera and rendering with the render camera without ever changing the active camera.

With Babylon, you can set up multiple cameras, but we don’t have the sense of an “edit camera” by default. This means your first created camera would be the same as a render camera in Blender. With this in mind, if we enable any debug helpers for camera navigation, they need to be off by default and enabled either in the inspector or through a parameter on camera creation for back compat.

1 Like

I agree with @PatrickRyan, that this is a tool in Blender, to change the rotation of editor view. This might be something useful for the playground / sandbox, though.

As a demo project it is fine, as part of the repo, there are a few things:

  • It only rotates. No position changing. Neither does the Blender equivalent, but there is Shift-middle mouse button dragging there.
  • It only works for Archrotate cameras.

I had built a tool that is just a mesh that sort of looks like a camera, which can be dragged, has a gizmo to rotate, and has buttons one of which is to write the current rotation / position to console (Snap).

It worked well for getting positions / rotations of a camera to be displayed as a render target while actually show the live scene. It was a nightmare before making this. Too bad I had to dump the idea due to WebXR not handling render targets.

If multi camera types & position being handled, it could be very useful.

1 Like