Board index FlightGear Development Aircraft

Modelling a 3D 'RADAR Beam'

Questions and discussion about creating aircraft. Flight dynamics, 3d models, cockpits, systems, animation, textures.

Re: Modelling a 3D 'RADAR Beam'

Postby robbo » Wed Feb 07, 2018 10:25 pm

I have successfully managed to add a submodel using XML to the main model by including my submodel within the ~set.xml file. I have also managed to add a submodel to an ai_scenario model by including my submodel within the scenario.xml, but I seem to be unsure of the properties needed to add the submodel using the propertyTree directly in the nasal console.

I have tried the following
Code: Select all
props.globals.getNode("models/model[1]/submodels/path", 1).setValue("/Models/Aircraft/H-60sm.xml"); #where model[1] is  one of the models I have added through the propertyTree
props.globals.getNode("models/model[1]/submodels/serviceable", 1).setBoolValue(1);


I noticed when I added the submodel using the XML techniques that nodes were created under /ai. Do I need to add these nodes manually also? I've tried searching through the forums/wiki, but don't seem to be able to find this documented anywhere, even though it is alluded to in several places.

I guess my question is this: what nodes do I need to create in order to attach a submodel to a model (that is not the main simulation model) using the propertyTree method? or is it possible using the fgcommand("add-model",...) method to slave a submodel to a model?

Thanks,
Robbo
robbo
 
Posts: 19
Joined: Thu Sep 15, 2011 9:38 pm

Re: Modelling a 3D 'RADAR Beam'

Postby Thorsten » Thu Feb 08, 2018 7:01 am

Please keep apart child models and submodels - the latter are detachable objects which get their own (rather limited) FDM computation for ballistic flight and air resistance once released - used for bombs, droptanks, etc. The former are simply additional models loaded relative to the parent model inside the parent model xml wrapper (pretty much every aircraft contains multiple example of such child models).

Unless you want to be able to drop your radar beam, you do not need a submodel, you simply need to include a child model. Basically it's like an aircraft door - you want something that is attached to the aircraft, but that you can rotate around using properties.

So you're looking to create an xml wrapper for your 3d model of the beam which contains the animations rotating it, scaling it and making it invisible if de-selected and you want to include that xml wrapper within the aircraft model xml.
Thorsten
 
Posts: 10587
Joined: Mon Nov 02, 2009 8:33 am

Re: Modelling a 3D 'RADAR Beam'

Postby robbo » Thu Feb 08, 2018 8:33 am

Thanks Thorsten,

I had not made that distinction (I must be getting slow in my old age!). Anyway I have managed to achieve the effect (and control) that I was looking for. The following code adds the 'child' model to my main model, slaving the lat/lon/el to the parent, but allowing me control over the heading and pitch independently.
Code: Select all
#model[1] is the aircraft parent node
#model[1]/model is the child (which will eventually be a radar cone, not a square!)
props.globals.getNode("models/model[1]/model", 1);
props.globals.getNode("models/model[1]/model/elevation-ft-prop", 1).setValue("models/model[1]/elevation");
props.globals.getNode("models/model[1]/model/latitude-deg-prop", 1).setValue("models/model[1]/latitude");
props.globals.getNode("models/model[1]/model/longitude-deg-prop", 1).setValue("models/model[1]/longitude");
props.globals.getNode("models/model[1]/model/heading", 1).setDoubleValue(90);
props.globals.getNode("models/model[1]/model/pitch", 1).setDoubleValue(0);
props.globals.getNode("models/model[1]/model/roll", 1).setDoubleValue(0);
props.globals.getNode("models/model[1]/model/heading-deg-prop", 1).setValue("models/model[1]/model/heading");
props.globals.getNode("models/model[1]/model/pitch-deg-prop", 1).setValue("models/model[1]/model/pitch");
props.globals.getNode("models/model[1]/model/roll-deg-prop", 1).setValue("models/model[1]/model/roll");
props.globals.getNode("models/model[1]/model/path", 1).setValue("Models/Geometry/square.xml");
props.globals.getNode("models/model[1]/model/load", 1);
props.globals.getNode("models/model[1]/model/load", 1).setBoolValue(1);
props.globals.getNode("models/model[1]/model/load", 1).remove();
robbo
 
Posts: 19
Joined: Thu Sep 15, 2011 9:38 pm

Re: Modelling a 3D 'RADAR Beam'

Postby Hooray » Sat Feb 10, 2018 12:28 pm

Thanks for reporting back here - but I still believe that it would be a good idea to document your progress via the wiki - you can easily add screenshots/youtube videos there, and also update things in the future, and it will be much easier for others to get involved to help update/maintain your article.
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: 11312
Joined: Tue Mar 25, 2008 8:40 am

Previous

Return to Aircraft

Who is online

Users browsing this forum: Applebot [Bot] and 3 guests