> From: Frank Olaf Sem-Jacobsen > > I have finally had the time to try to start messing around with > flightgear source code, and I thought it would be neat to be able to > look at the different multiplayer aircrafts when playing online. Since > it doesn't seem to support looking at any other aircrafts than your own, > I have started messing around in viewmgr and viewer to add that > functionality. I am now able to look at a multiplayer aircraft, but I'm > having trouble doing this dynamically from nasal. My first obstacle is > how do I create a property node to hold the currently selected > multiplayer aircraft? >
It sounds like what you are doing might be more complicated than necessary. How about adding a viewer instance onto the stack of viewers for each MP aircraft (as the MP aircraft are instantiated)? Essentially I would suggest that you use the existing viewer class as a building block rather than making it more complex. You could always add multiple views for each MP aircraft if you want, and you can do things like add a property to the viewer class that identifies MP related viewer objects in order for your script to be able to cycle through just those. In any case the only information you would need for this approach would be the "current view" property that already exists. Adding new viewers on the fly might be something that needs to be added to the viewmgr for this approach. If this doesn't sound like what you are looking for, then perhaps you would want to do something like create a class that is part of the MP system that essentially keeps track of the location data for all the MP aircraft and ties the "currently watcheed" MP aircraft's location to a common property tree location. This class's only job would be to keep track of which is the currently watched MP aircraft, and then for each cycle, copy the location data for that aircraft to that common property location for which a view (or collection of views) is defined. I've been saying "class" but I'm sure you could implement the whole thing in a nasal script. Either way, this approach should work fine without any modification to the viewer or viewmgr classes. Adding this (as I described here) as extended functionality to the viewer or viewmgr class is probably not a good design option. Best, Jim -- Jim Wilson Kelco Industries PO Box 160 Milbridge, ME 04658 207-546-7989 ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel