Graphics.SphereFly - lordmundi/wikidoctest GitHub Wiki

Sphere Fly

NOTE: After EDGE version 2.1, you can use the trackcam plugin to make a camera track a particular node, which makes this easier. A more generic solution is below. — frankie April 14, 2010, at 07:12 PM

Sometimes it is useful to be able to rotate a camera while keeping it pointing at a particular area of interest. For example, maybe you want to fly around look at a particular model without having to translate and rotate at the same time. This can be done without using a plugin or script by just using the node/tree geometry.

This takes advantage of the fact that most of the cameras in DOUG scenes have the camera node parented to a separate system node which is the actual node moved around when using the keybinds (i.e. JimboCam is a camera node, but it is parented to a system node called "JIMBO" which is what is moved when flying with the keyboard).

In this example, we will use the JimboCam/JIMBO node pair and make them fly around the HTV node.

  1. Using the node edit dialog, search for the "JimboCam" camera node and double click
  2. Reparent JimboCam to the node of interest, "HTV" in this case
  3. Using the node edit dialog, search for the "JIMBO" system node and double click
  4. Reparent JIMBO to the node of interest, "HTV" in this case
  5. Set the X,Y,Z, Pitch, Yaw, and Roll all to zero for on the JIMBO node
  6. Edit the "JimboCam" node again and reparent it back to "JIMBO"
  7. Set the Y, Z, Pitch, Yaw, and Roll all to zero for the JimboCam node (but not X)
  8. Set the X value of JimboCam to the negated value of the radius of the sphere you want to traverse

Now you should be able to use the rotation buttons (normally, up, down, left, right, "," and "." to rotate the camera around the node of interest.

Warning: Do not use the translation buttons, or this will get all screwed up. Rotate only! Also, if it doesn't work, try making the X value positive instead of negative.

jjoltes: To make a custom camera display this sort of behavior, one additional step not mentioned above is needed: specifying which node's attributes are to be modified when the camera is moved. This can be easily accomplished in a tcl script that is added to the post load block of your user.cfg (or equivalent).

The script takes the following form:

array set camLR   { <camera_node> <camera_parent_node> }
  array set camUD   { <camera_node> <camera_parent_node> }
  array set camIO   { <camera_node> <camera_parent_node> }
  array set camPan  { <camera_node> <camera_parent_node> }
  array set camTilt { <camera_node> <camera_parent_node> }
  array set camSpin { <camera_node> <camera_parent_node> }

This indicates that when any translation/rotation is made on camera_node, the camera_parent_node moves instead, allowing for the desired behavior to be accomplished.

frankie September 08, 2011, at 05:48 PM: That's correct Jeff. This configuration is exactly what is already done by default for JimboCam, which is why it works in the above instructions without these extra steps. If you have added your own, you will need to specify that the system node that the camera is parented to is what you want to move when you pan, tilt, roll, and translate using Jeff's commands above.