Graphics.AddingAVehicleCamera - lordmundi/wikidoctest GitHub Wiki

Adding a Vehicle Camera

« Adding a camera | EDGE User’s Guide | Adding a Tcl Script »

When you add cameras to the scene that are physical pan/tilt cameras (like cameras on a vehicle or lander) then you need to have separate pan/tilt nodes since the point at which they pan or tilt will not be at the same location (they will be offset from one another).

So, you set these up with parenting relationships just as you would with any other (See Adding a Camera). However, there are 2 cases where EDGE needs to know that a camera has separate nodes for pan and tilt:

  1. For commanding with the keyboard: When a user hits the arrow keys, you want the camera to use the correct pan and tilt nodes and respect the pan and tilt limits. This makes sure that the camera moves as it should, and if specified as a camera attached to a vehicle, doesn't allow it to be translated.
  2. For displaying pan/tilt overlay values: EDGE has some built in overlay support for showing camera info so if a pan node and tilt node are specified, it will know where to extract the information for the pan/tilt values (mainly the yaw of the pan node, and the pitch of the tilt node).

Correspondingly, you need to specify the the pan node and tilt node in 2 places:

  1. Create a file under $DSP_USER_OPTION_PATH called "cam.user". "DSP_USER_OPTION_PATH" defaults to "$USERDATA/options". In the file called cam.user, use the same syntax as the existing file at "./options/cam.default". These files are both sourced by keybinds.tcl and sets up the corresponding arrays so that point #1 above is honored. The syntax for this is specified in the cam.default file. It basically specifies what pan/tilt nodes to use, the limits, the polarity (for example if pushing the right arrow on the keyboard should increment or decrement the pan angle), and vehicle name (to specify that a camera is actually tied to a vehicle and is not free_flying in space). Again, see cam.default for syntax.
  2. When creating the cameras in the "DSP_CONFIG→DATA→SCENE_LOAD→CAMERAS" block, make sure you specify a "pan_node" and "tilt_node" for the camera. They syntax for this is outlined in userdata/user.cfg.