Board index FlightGear Development Canvas

Identify other Aircraft out the cockpit window

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

Identify other Aircraft out the cockpit window

Postby qwsaaswq » Mon Jun 27, 2016 7:23 pm

Hey everybody I'm currently trying to incorporate certain requested features into my flight gear, and I figured I should ask someone before reinventing the wheel on this one. So in another simulator I'm working with there are a couple ways to easily identify other aircraft in the sim by just looking outside the cockpit window, for example either a boundingbox or gui text is attached to the other aircraft and this can be toggled on/off. I wanted to know if there was like a plugin or something that I could run to replicate this, and I don't simply want to attach an OsgText to an aircraft and scale it based on my distance as that is still a 3d model and can be obscured by other models. If not I saw the f-14b has "target-lock/tracking" on it's hud, would it be too difficult to implement something similar but all ai/multiplayer targets found in the PropertyTree are identified by their callsign. :oops: I know this isn't exactly adding to the realism but for my needs any help is appreciated, thanks in advanced.
qwsaaswq
 
Posts: 2
Joined: Tue May 31, 2016 2:00 pm

Re: Identify other Aircraft out the cockpit window

Postby Hooray » Mon Jun 27, 2016 7:45 pm

the position of each AI/MP aircraft is known, can be obtained via the property tree - you can get a bearing/distance and altitude, see aircraft.nas and geo.nas in $FG_ROOT/Nasal for details. IIRC, there also is some line-of-sight helper somewhere that checks if the the line of sight is occluded or not.
So, if you can live with these workarounds, it can be done using a custom Nasal/Canvas HUD, but you will obviously need a bit of math to project the 3D view onto the 2D HUD

If you want this to work for non-cockpit views, you will have to use a different approach ...

Anyway, you will need some trig to come up with a mapping that works well enough - i.e. any aircraft at your 12'o clock (relative bearing=0) would be at the center of your HUD, as long as it has the same altitude - you'd scale based on range to the target, and then use the width/2 to compute a relative offset to the right and to the left of the HUD's center, and do the same for altitude (height of the HUD). Depending on what you have in mind, could get much more fancy obviously, but that should do for starters.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Identify other Aircraft out the cockpit window

Postby Harald » Tue Jun 28, 2016 6:32 pm

Perhaps spawn a 3d object that have a billboard animation with an osg text animation, set what you want in that osg text (name of the player, etc), and frequently update the position of that object with the positions of the corresponding MP object. Then spawn your text object for each MP object.

Edit : you can perhaps try other render bins or effect if you don't want that text to be behind other objects, or remove z test in an effect (not sure if it's possible).

hj.
Harald
 
Posts: 179
Joined: Fri Mar 02, 2007 5:30 pm
Location: Strasbourg, France
Version: nightly
OS: Windows 10

Re: Identify other Aircraft out the cockpit window

Postby Hooray » Tue Jun 28, 2016 7:46 pm

even then, geo.nas would still be your friend
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU


Return to Canvas

Who is online

Users browsing this forum: No registered users and 5 guests