@thomasaull Thanks, I may at some point ask you about the script if you are willing to share. Btw, this was the issue I ran into when unsuccessfully trying to apply FramingBehavior
to Free/UniversalCameras
. (Although the API really leads me to believe it should just work…)
Hmm so basically I’m using a UniversalCamera behind the scenes, attaching my own controls to the camera. So if Framing Behviour works with the Universal Camera it should work here aswell (although apparently it’s not working with the Universal Camera )
I published the script over here: BabylonJsEditorCamera.js · GitHub
Thanks for the link!
On a second read through the docs, it seems not to be a bug but documented in the FramingBehavior
that it only works with ArcRotateCamera
types. From the docs:
The framing behavior (FramingBehavior) is designed to automatically position an ArcRotateCamera
when its target is set to a mesh. It is also useful if you want to prevent the camera to go under a
virtual horizontal plane.
Apologies, i must have just read that Camera
implements IBehaviourAware
back then and thought that therefore setting any behaviours would work. However, it would still be nice if FramingBehavior
worked for UniversalCamera
as well.
Hey @thomasaull, that rocks !!! Typical controls editors need
Are you interested to integrate it in the editor directly ?
@julien-moreau I probably won’t find for it in the near future, I’d be more than happy to assist if you want to integrate it though! This is how I’m using it in my project, basically I use an UniversalCamera with custom controls, the attachment of the EditorCamera works like this:
myUniversalCamera.inputs.remove(myUniversalCamera.inputs.attached.mouse)
myUniversalCamera.inputs.remove(
myUniversalCamera.inputs.attached.keyboard
)
myUniversalCamera.inputs.remove(myUniversalCamera.inputs.attached.touch)
myUniversalCamera.inputs.add(new EditorCamera())
Where new EditorCamera
would be an instance of the script I posted earlier.