Board index FlightGear Development Nasal

Custom dialog, nasal console etc. to fire a missile?

Nasal is the scripting language of FlightGear.

Custom dialog, nasal console etc. to fire a missile?

Postby neyim123 » Thu May 05, 2011 9:30 am

Hello FlightGear developers:

I want to simulate a missile fired from plane. So my questions are:

* Can I design a dialog, button or something like that when user clicks it, an action can be performed (functions in C++ can be called) ?
* Is it possible to write some Nasal scripts and call it from Nasal console to fire missile?
* Is it possible to print some messages to the screen? For example when missile shoots an object.

If anything is possible, how can I do? Is there any reference material or source code to study?

Thanks for your reading.
neyim123
 
Posts: 5
Joined: Wed Mar 30, 2011 8:17 am

Re: Custom dialog, nasal console etc. to fire a missile?

Postby hvengel » Thu May 05, 2011 8:02 pm

There are aircraft that fire missiles or rockets that you can look at to see how it is done. In part it might depend on the missile/rocket being fired since many of these are guided (IE. have guidance systems that can steer the missile) which makes thing more complex. One example of an aircraft with basic (ballistic not guided) rockets is the JSBSim version of the P-51D, available in GIT, which can be loaded with up to 10 HVAR rockets. I think there are models for recent jets that also have missiles. I would look at the F-14 or the A-10 first as I am not sure which jets have these.
hvengel
Retired
 
Posts: 1128
Joined: Sun Dec 24, 2006 4:35 am
Location: Minden Nevada

Re: Custom dialog, nasal console etc. to fire a missile?

Postby Thorsten » Fri May 06, 2011 6:35 am

The F-14 has a guided Sidewinder of fairly high sophistication - that's as far as I know the most advanced A-A weapons system in Flightgear.
Thorsten
 
Posts: 11123
Joined: Mon Nov 02, 2009 8:33 am

Re: Custom dialog, nasal console etc. to fire a missile?

Postby neyim123 » Fri May 06, 2011 7:19 am

Thanks hvengel and Thorsten.

I do not know how missiles work with F-14 but I will look at the codes. In my project there is a missile already designed. I just want click a custom button to fire my missile and start to simulate that missile. It does not important which airplane will be used. It even can be c172p :)

Indeed I do not need to "see" that missile, for the first phase, I just need coordinates of the missile.

Thanks for your answers...
neyim123
 
Posts: 5
Joined: Wed Mar 30, 2011 8:17 am

Re: Custom dialog, nasal console etc. to fire a missile?

Postby xiii » Fri May 06, 2011 3:18 pm

Hi neyim123

You can check $FGDATA/Aircraft/f-14b/Nasal/fox2.nas (in Git) which models a tiny part of a complex weapons system.
- It checks for available weapons with respect of the pylon position.
- checks for missile readiness (all switchs on right position and time to temperature of the IR seeker).
- activates one missile search function.
- search for a possible target.
- locks on the target and check if any lock out condition. Calculate HUD symbology (diamond displayed over the target position in the HUD)
- checks for fire order
- calculates exact position/orientation/velocity when fire order so we can spawn a new AI object in the proper place.
- releases the missile and guides it with a crude FDM
- if available activates a new searching missile and drives both fired and searching objects (we can guide several fired missile (flying and tracking) and have an additional one in searching state (on its pylon and searching or tracking). Each object can have its own target.
- checks for (near) impact or lock out condition
- if impact, creates the properties used by bombable.nas so the target is actually damaged, and some other properties for the explosion graphical animation. Also it displays the distance from the target on the player screen when the missile explode.
There is a menu item in "Tomcat Controls" with a switch which allows those informations to be displayed as messages over MP.

The script works with Git version. If you are interested in how the impact handled on the target side, you'll have to checkout a modified version of bombable.nas available here
The weapons system manual is available on the wiki

Sorry, it's all but a simple script but if it can help...

Alexis
If the engines are Pratt and Whitney, the seats best be Martin Baker
xiii
 
Posts: 472
Joined: Tue Jan 08, 2008 10:04 pm

Re: Custom dialog, nasal console etc. to fire a missile?

Postby neyim123 » Sat May 07, 2011 7:22 am

Thank you Alexis,

The script you mentioned seems to be the best solution for me.
neyim123
 
Posts: 5
Joined: Wed Mar 30, 2011 8:17 am


Return to Nasal

Who is online

Users browsing this forum: No registered users and 0 guests