> From: "Alberico, James F"
> 
> Hi,
> 
> I'm trying to track down how I can attach a view to another object in
> the sim, particularly for a multiplayer aircraft other than the ownship.
> I would like to switch to the viewpoint of each of the "other guys" in
> the virtual world.
> 
> As documented at http://flightgear.org/Docs/fgfs-viewer-howto.html :
> 
> --------
> Syntax for the eye position is: 
>     <from-model type="bool">true or false</from-model>
>     <from-model-idx type="int">modelnumber</from-model-idx>
> Syntax for the target or at position used in views of type "lookat" is: 
>     <at-model type="bool">true or false</at-model>
>     <at-model-idx type="int">modelnumber</at-model-idx>
> ---------
> 
> But I can't find out where the "modelnumber" comes from, or what it
> really means.  All the examples use zero, so I've assumed that was the
> ownship.
> 
> I've looked through the code and docs, and searched many of the
> mailing-list archives, but haven't found any examples or explanations
> yet.  A idea of how to use this for "models" in general, followed by
> understanding the implications and current capabilities for multiplayer
> "otherships" would be great.
> 
> Any help would be appreciated, even references to archived discussions.
> Thanks!
> 

The model number was originally a concept which was thought to provide a hook 
for accessing the location of a particular model.  Basically, it would 
internally end up going back to the FGLocation object for a particular model in 
order to reference it's position and orientation data.  This would be set up by 
the model manager,  be reserved for just aircraft models, and would provide a 
method of accessing models as an array of objects, similar to how the view 
manager sets up views.

AFAIK this has not been implemented.  The AI models, the scenery model work, 
the 3D cockpit, aircraft model work has involved a few developers and even so 
it is very well organized.  It probably wouldn't actually take much to index 
the aircraft models and allow a view mode that rotates through a dynamically 
modified list of views which are sourced at the location of multiple models 
(without having to set each view up individually in preferences.xml).  Some 
modifications to the code would be required.

Without that happening, or happening right away, you can still acheive 
something similar by setting up additional views in preferences.xml.  If you 
look at the "Look From" Tower in preferences.xml you'll see clearly how you can 
reference position and orientation values from anywhere in the property tree.  

And if I remember this code correctly,  you can probably modify these "property 
paths" on the fly.  For example if you had a nasal script that changes the 
string value in "/config/eye-alt-ft-path" then in fact the source property of 
the altitude of the view would change, next time the view manager class updates 
(every frame).

Look especially at the update function in the viewmgr.cxx file in 
FlightGear/src/Main.

Hope this helps.

Best regards,

Jim



_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to