How to write a view helper


I write a demo, but I don’t think it’s a good way!

Sorry I am not sure to understand the question would be great if you could clarify ?

Like this, the view helper will rotate according to the camera of the scene,
and clicking the x,y,z of the helper will change the direction of the camera.

From your animated gif, it looks like you want one camera with different settings and not any of the things you mentioned. Maybe an ArcRotateCamera will be sufficient?

I think I need 2 cameras, I wrote a demo

Maybe @Cedric gizmos could be used on the second cam ?

I did a quick PG some time ago : Babylon.js Playground
I think you’ll need 2 cameras: one for the 3D view and 1 for the view gizmo.
But it’s also possible to use 1 camera with a bit more complex computation so the gizmo is always at the same position in screenspace.
A new gizmo would be needed for that but most of its mecanism like picking would work.
It mostly depend if the code would endup being in the engine. In that case, I could create a ‘cameraViewGizmo’ inheriting from gizmo, attachable only to a camera and with a intermediate transform node between the camera and the rendering. I would then move that transform relatively from the camera.
If it would end in app, I would create a new view port, a new scene and handle everything from that.


That is the correct way to do it.
Might be able to look at what Pixcap did too they have a pretty slick one.

This scheme is the same as my demo idea, and it may be a better implementation scheme at present.

Hello @ZoeLeee just checking in, do you have any more questions :slight_smile: