wiki:XmlModelConfiguration

<< Back to XML configuration overview

XML configuration of visual_object based models

To visualize models, you can place visual_objects in teh scenery. you have to specify the object name (=osg::Node Name), the tracking ID to allow easy tracking of the objects (currently, extLinkVCL can only transport numbers, so tracking by name is not possible - therfor a tracking ID was introduced). You can add a text label to the object, which is attached to the object.

The flag "dynamic" indicates if an updater should be created and added to the object. If no <updater> entry is found, this updater will be the default updater. Otherwise, the updater slots are reconfigured according to the XML values. If dynamic is "no", no updater class will be added, even if an updater is specified in the XML configuration section.

The XML Configuration of a complete visual_Object is:

<model objectname="TestObject" trackingid="1" label="TestText!" dynamic="no">
 <position lat="47.8123" lon="12.94088" alt="700.0"></position>
 <attitude rot_x="0.0" rot_y="0.0" rot_z="0.0"></attitude>
 <updater>
  <position lat="" lon="" alt=""></position>
  <attitude rot_x="" rot_y="" rot_z=""></attitude>
  <label text=""></label>
 </updater>
 <cameraoffset>
  <translation trans_x="0.0" trans_y="0.0" trans_z="0.0"></translation>
  <rotation rot_x="0.0" rot_y="0.0" rot_z="0.0"></rotation>
 </cameraoffset>
 <geometry filename="../models/saenger1.flt">
  <offset rot_x="0.0" rot_y="0.0" rot_z="0.0"></offset>
  <scalefactor scale_x="1.0" scale_y="1.0" scale_z="1.0"></scalefactor>
 </geometry>
</model>

Position & Attitute

To position the visual_object, you have to setup a location in latitude (in degree), logitude (in degree) and altitude. Additionally you have to specify it's attitude in degree.

<position lat="47.8123" lon="12.94088" alt="700.0"></position>
<attitude rot_x="0.0" rot_y="0.0" rot_z="0.0"></attitude>

Updater

To update certain properties of the visual_object, you can define an updater and configure the slot names which should be used for the updates. The attributes in the XML entries are not values but names of the slots which content should be used for updating the visual_object every frame. To skip updating of a certain value, leave the updatername emtpy.

The updater can be defined in the XML configuration file as followed:

<updater>
 <position lat="your_lat_slot" lon="your_lon_slot" alt=""></position>
 <attitude rot_x="your_rot_x_slot" rot_y="" rot_z="your_rot_z_slot"></attitude>
 <label text=""></label>
</updater>

Camera Offset

To use the "Object mounted" camera manipulator, you have to define what the camera coordinates relative to your visual_object are. You can define a rotational (in degree) und translational offset.

The defition of the camera offset in the XML configuration file is:

<cameraoffset>
 <translation trans_x="0.0" trans_y="0.0" trans_z="0.0"></translation>
 <rotation rot_x="0.0" rot_y="0.0" rot_z="0.0"></rotation>
</cameraoffset>

Geometry

You can load and display a 3D geometry to visualize the 3D object. You have to specify the filename with an relative or absolute path. If the 3D model has the wrong orientation or wrong size, you can specify an offset rotation (in degree) or scale factors. Using a geometry as well as modifying it with offset or scalefactors is optional.

The XML configuration of an geometry entry in a visual object is:

<geometry filename="../models/saenger1.flt">
 <offset rot_x="0.0" rot_y="0.0" rot_z="0.0"></offset>
 <scalefactor scale_x="1.0" scale_y="1.0" scale_z="1.0"></scalefactor>
</geometry>

If you do not use a geometry, a visual_object is still usefull, e.g. for dynamic positioning and upating a text label or to attach the camera.

Last modified 8 years ago Last modified on Feb 18, 2011, 8:39:35 PM