How to create custom plugin for Sandbox

Basically, looking for how to modify the Sandbox behavior and functionality with a plugin for different camera types. But think different camera types should be the default, and if only one it should be the Universal Camera with mouse-wheel for zooming in and out. It offers the most freedom of movement.

cc @ryantrem

Sandbox itself does not currently have the concept of plugins/extensions, but Inspector does, and Inspector can be launched from within Sandbox. There are a few possible answers, depending on what you mean though:

  1. There is already a “Creation Tools” extension that lets you create various different types of cameras, and then in the Inspector scene explorer you can pick which camera you want active.
  2. If you are trying to have something that is faster, like just an Inspector toolbar dropdown to pick between a few pre-configured cameras, then that could be done with an extension. For that, the best bet now would be to submit a PR with the extension added to the packages\dev\inspector-v2\src\extensions directory. You can check out the “Creation Tools” as an example, plus we have docs here: Extensibility API | Babylon.js Documentation and Examples | Babylon.js Documentation
2 Likes

Here is what I have now ( GitHub - r2d2Proton/Babylon.js: Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework. · GitHub ) - repelled by the maintainers but I think a camera dropdown is a useful addition regardless of how it is added. I like the camera icon too:

@ryantrem Thoughts on implementing a camera in the Sandbox that offers the most user flexibility. If we do not want a dropdown of different styles of cameras, then my proposition is offer the most flexible camera with mouse/keyboard/gamepad and all inputs support. My pull request allows for switching camera type midstream, without reloading the scene, without changing the position.

What I would try right now is to create an Inspector v2 extension (see the examples I previously linked) to add a dropdown to the toolbar to select different preconfigured cameras, and maybe put those cameras in a utility layer (using UtilityLayerRenderer). It does mean you would have to enable Inspector before you can see the camera selector, and it would only work while Inspector is enabled, but it still might be the best bet right now. You can try this within the Babylon codebase by adding the extension to the packages\dev\inspector-v2\src\extensions folder.

I will try those later. I did perform a cursory view of the first document. Missed the second link or lost track of it. I try to keep Edge updated with a specific list of pages to reopen. But it still does not address the restrictive nature of the arc-ball camera.

Maybe I’m misunderstanding something, but anything you wanted to do directly in the sandbox toolbar you should be able to do effectively the same thing in the inspector toolbar (through an inspector extension).

How do I move the arc-ball camera position using the keyboard, mouse, gamepad? Basically, how do I move about the scene, pan the scene using the ArcBall camera? Not just rotate it.

Sorry just to be clear, are you still asking about being able to select different cameras in Sandbox, or is it now more of a question about the flexibility of ArcRotateCamera specifically? Happy to continue the discussion either direction, just want to know which direction to take it! :slightly_smiling_face:

1 Like

I am an AND type of person. Is there a way to update the ArcRotateCamera position using the keyboard, mouse, gamepad? That way I can view the entire scene from any vantage point.

You can change the target point that the camera rotates around with right mouse click and drag, ctrl+left click and drag, or the arrow keys. Effectively this is panning the camera.

1 Like

Thank you. I will give that a try.