Board index FlightGear Development New features

Submodel pitch and heading controlled by property

Discussion and requests for new features. Please note that FlightGear developers are volunteers and may or may not be able to consider these requests.

Submodel pitch and heading controlled by property

Postby jack » Mon May 09, 2011 4:43 am

So, what I want to do, is basically point a submodel different directions, to simulate a multiple axis turret firing.

Image

As shown in the above image, armed helicopters like the AH-1, AH-64, Mi-24, etc. usually have turrets that can be aimed 220º on the y axis, and 90º along the z axis.

Also, some fighter aircraft have radar controlled guns, where the aircraft's radar makes small adjustments(less than 10º on the z and y axis) to the guns orientation to make hitting another aircraft easier.


So, my question is; Can this be achieved? What would be necessary to achieve this?




This would be a huge step forward in the realism of our weapons systems, and would be plain out awesome. :)
For Military Aircraft, Scenery, and more, visit http://alphashangar.co.nr/

'Retired' from FlightGear as of July 2011. You can contact me via my website if you'd like to pick up any old projects.
jack
Retired
 
Posts: 1432
Joined: Wed Mar 03, 2010 12:26 am
Location: KLVK
Callsign: Alpha-J, Rescue1
Version: GIT
OS: Mac OS X

Re: Submodel pitch and heading controlled by property

Postby skyop » Mon May 09, 2011 11:55 pm

I'm not familiar with submodels, so I can't comment on that, but...

jack wrote in Mon May 09, 2011 4:43 am:Also, some fighter aircraft have radar controlled guns, where the aircraft's radar makes small adjustments(less than 10º on the z and y axis) to the guns orientation to make hitting another aircraft easier.


Should be possible with heavy use of Nasal, and the radar instrument (which I believe writes its properties to /ai/models/xxx[n]/radar). Here's a theoretical(!) sample of the required code:
Code: Select all
var heading = getprop("/orientation/heading-deg");
var aircraft = props.globals.getNode("/ai/models").getChildren("multiplayer");
for (var i = 0; i < size(aircraft); i += 1)
 {
 var offset_z = heading - aircraft.getNode("radar/bearing-deg", 1).getValue();
 props.globals.getNode("/sim/targeting/target[" ~ i ~ "]/bearing-deg", 1).setValue(offset_z);
 }

That calculates the difference between the aircraft's heading and the target's direction. Of course, one could make use of geo.Coord to forgo the use of the radar instrument. And this would have to be rerun every 1/2 second or so.
Aircraft: [ CRJ700-family | DC-10-30 ] Scenery: [ KBFL ]
skyop
 
Posts: 3040
Joined: Mon Jun 14, 2010 1:40 am
Location: Austin, Texas, USA
IRC name: skyop
Version: next
OS: Fedora 23/Windows 10


Return to New features

Who is online

Users browsing this forum: No registered users and 2 guests