Best way to map FreeD-based coords of PTZ cam onto glTF-based camera in Babylon.js?

I’m new to Babylon.js and hence I’m overwhelmed with the large amount of functionality and details in Babylon.js. I have a Birddog PTZ camera in front of a rounded greenscreen and this scene is 1:1 modeled in a basic 3D model inside Blender in order to project large images onto the rounded greenscreen in a natural fashion. I can successfully export the model from Blender to Babylon.js through glTF and when I use getCameraByName(), Babylon.js already correctly renders the scene as it is in Blender.

The Birddog PTZ camera now sends FreeD-based coordinates 30 times per second via UDP to a small server which I forward via WebSockets into my Babylon.js app. I now finally want the camera in Babylon.js to pan/tilt/zoom in sync with the physical Birddog PTZ cam, of course. The FreeD coordination system for pan/tilt has floats from -180 degree to +180 degree and for zoom it is a float in the range from 0 to 20. The questions to me now are:

(1) what optimal type of Babylon.js camera should I use for PTZ (e.g. DeviceOrientationCamera)?
(2) how can I convert the camera from getCameraByName() into this optimal target camera type?
(3) how do I translate the FreeD coordination system into the coordination system of the Babylon.js camera?

Welcome aboard!

Given the schema page 23 of this doc, you could try to feed the ArcRotateCamera.beta with the tilt value and ArcRotateCamera.alpha with the pan value (both in radians). And maybe ArcRotateCamera.radius with zoom?

1 Like