Board index FlightGear Development AI Traffic

animating AI PA-28 lights  Topic is solved

Intelligent, computer controlled vehicles that drive/fly over the planet!

Re: animating AI PA-28 lights

Postby BecOzIcan » Mon Jul 30, 2018 3:07 pm

wkitty42 wrote in Mon Jul 30, 2018 2:59 pm:dude... you're not thinking ;) in the sim, hit "/" to bring up the property tree... now go to ai/models/aircraft/controls/lighting... see those three booleans defined? hold your CTRL key down and click on the beacon line and watch it toggle from 'true' to 'false'... CTRL-click it again and watch it toggle back... the nav-lights one is broken and won't toggle but beacon and strobe will... every single boolean in the property tree can be toggled with CTRL-click...


Totally thinking. I guess I thought you wanted to use ctrl click to expose movable part on your aircraft, like an FDM one.
Current Projects: AI Traffic, Models & Liveries
User avatar
BecOzIcan
 
Posts: 1302
Joined: Tue Oct 04, 2011 11:43 pm
Location: Sydney, NSW, Australia
Version: 2020.4.0
OS: Win10

Re: animating AI PA-28 lights

Postby wkitty42 » Mon Jul 30, 2018 3:14 pm

oh! no... i was talking about manipulating the properties directly in the property tree for doing crazy things like testing that the lights would turn on/off depending on if the property were true or false... it's ok, though... we're good :lol:

besides, it is 0200 tomorrow morning on your side of the world right now... it is only 1000 in the morning here :)
Last edited by wkitty42 on Mon Jul 30, 2018 3:21 pm, edited 1 time in total.
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: animating AI PA-28 lights

Postby BecOzIcan » Mon Jul 30, 2018 3:16 pm

wkitty42 wrote in Mon Jul 30, 2018 3:06 pm:so object-name is not assigning the object's name that we're going to use?


Nope. I would refer you to http://wiki.flightgear.org/Howto:Animate_models, again, especially the .ac part

Ian
Current Projects: AI Traffic, Models & Liveries
User avatar
BecOzIcan
 
Posts: 1302
Joined: Tue Oct 04, 2011 11:43 pm
Location: Sydney, NSW, Australia
Version: 2020.4.0
OS: Win10

Re: animating AI PA-28 lights

Postby wkitty42 » Mon Jul 30, 2018 3:27 pm

i've been there 1000 times... it doesn't tell me, in plain straight language, where the names come from...there's nothing that states plainly
Code: Select all
The name of the object in the ac file is the only name you can use to reference that object, ever.
or similar...

i do see the short section on that page about the "object-name" tag... maybe that's what you're referencing? if so, it could be clearer and the information given a few more times in other related sections throughout the wiki... especially when you have sections like this 3 Identifying an object which i edited the other day because there was no example at all...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: animating AI PA-28 lights

Postby BecOzIcan » Mon Jul 30, 2018 3:30 pm

".ac files
When referring to an .ac file in your xml animation, it is important that the <object-name> exactly matches the object named in the .ac file (this includes cases!)"
Current Projects: AI Traffic, Models & Liveries
User avatar
BecOzIcan
 
Posts: 1302
Joined: Tue Oct 04, 2011 11:43 pm
Location: Sydney, NSW, Australia
Version: 2020.4.0
OS: Win10

Re: animating AI PA-28 lights

Postby wkitty42 » Mon Jul 30, 2018 3:48 pm

wow! when i look at that section, all i see is
Image See Aircraft-set.xml#Not used for loading multiplayer aircraft for the main article about this subject.

the rest is visual noise because it doesn't appear to be what we're looking for... in this case, we're looking for "how to load an object and what name to use to reference it"... that just doesn't come out in the rest of that section buried in the noise...

there's also that that section is in "Notes" which kinda puts it aside, as well... something basic and important like this should NOT be in a ""Note"" somewhere... it should be pointed out over and over in the basic coverage areas to make sure that it is not missed...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: animating AI PA-28 lights

Postby wkitty42 » Mon Jul 30, 2018 5:40 pm

okokokokokok... i've converted several of the craft i've been working with on this lighting thing... no more nasal... the problem is there's no randomization... the strobes and beacons flash at the same time using the "isstrobe" property in the effect files... i can use the existing "controls/lighting/*" properties to control the lights being enabled or not but the nav-lights property seems to be tied up somewhere else and it will not toggle like boolean's are supposed to do...

i'll bring these two problems up in their own topics and hope for a quick solution...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: animating AI PA-28 lights

Postby WoodSTokk » Tue Jul 31, 2018 12:45 am

wkitty42 wrote in Mon Jul 30, 2018 3:06 pm:
BecOzIcan wrote in Mon Jul 30, 2018 2:50 pm:See for example the two different main.xml for AI Aircraft 735, one will show the winglets, the other won't (even if the object is still loaded with the geometry)

so object-name is not assigning the object's name that we're going to use?

you can't do this?
Code: Select all
<model>
  <path>object1.ac</path>
  <object-name>beacon-top<object-name>
</model>
<model>
  <path>object1.ac</path>
  <object-name>beacon-bottom<object-name>
</model>


No. The mapper of a model assign names to the objects.
I have now taken the time to show you the pa-28 as it looks in blender.
Image
On the right side, you see the list of all objects that are defined in this model.
As you can see, the object that represent the beacon light is named 'Beacon'.
So you can't assign other names within the XML.
What you can do is animating (select, translate, rotate, etc...) all that object.

If there are open questions about models, feel free to ask.
WoodSTokk
 
Posts: 1077
Joined: Tue Oct 17, 2017 3:30 pm
Location: Milky Way/Sol/Earth/Europe
Callsign: SX-W57
IRC name: WoodSTokk
Version: 2020.4.0
OS: Debian Bullseye

Re: animating AI PA-28 lights

Postby wkitty42 » Tue Jul 31, 2018 8:19 pm

thanks... the thing is that we're using our own models for the lights... not the ones that may be inside the craft's ac file... it should also be mentioned that we're using the craft in AI/Aircraft which are generally stripped down models...

but, yes... thank you for answering the question about the objects' names and where they come from...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: animating AI PA-28 lights  

Postby wkitty42 » Wed Aug 01, 2018 3:23 am

@BecOzIcan:

dude! we got it!! here's how to not pollute the /sim/model property tree... you should note that these properties all end in an 's' and there's no dashes in any of them... this to avoid confusion with other properties in controls/lighting that i think are misplaced in the ai/models/aircraft* tree... they are apparently for ai/models/multiplayer* craft... our AI Traffic craft don't need them and we can create our own like this when needed...

Code: Select all
  <!-- Enable Beacons and Strobes Pulse Behaviour -->
  <nasal>
    <load><![CDATA[

        var self = cmdarg();
        var selfPath = self.getPath();

        var beaconsStatus = selfPath ~ "/controls/lighting/beacons";
        var beaconsEnabled = beaconsStatus ~ "/enabled";
        aircraft.light.new(beaconsStatus, [0.5, 1.5]);
        self.setBoolValue(beaconsEnabled, 1);

        var navlightsEnabled = selfPath ~ "/controls/lighting/navlights/enabled";
        self.setBoolValue(navlightsEnabled, 1);

        var strobesStatus = selfPath ~ "/controls/lighting/strobes";
        var strobesEnabled = strobesStatus ~ "/enabled";
        aircraft.light.new(strobesStatus, [0.02, 0.02, 0.02, 0.02, 0.02, 1.98]);
        self.setBoolValue(strobesEnabled, 1);

      ]]></load>
    <unload></unload>
  </nasal>


that puts the control/lighting properties in the ai/models/aircraft* tree where they belong... then the effect files can just use eg: controls/lighting/beacon for the intensity_scale property... the following for beacon-top...

Code: Select all
<?xml version="1.0" encoding="utf-8"?>

<PropertyList>

  <name>Effects/beacon-top</name>
  <inherits-from>Effects/procedural-light</inherits-from>
  <parameters>
    <texture n="0">
      <type>white</type>
    </texture>
    <light_color_base_r type="float">1.0</light_color_base_r>
    <light_color_base_g type="float">0.0</light_color_base_g>
    <light_color_base_b type="float">0.0</light_color_base_b>
    <light_color_center_r type="float">1.0</light_color_center_r>
    <light_color_center_g type="float">1.0</light_color_center_g>
    <light_color_center_b type="float">1.0</light_color_center_b>
    <intensity_scale type="float"><use>controls/lighting/beacons</use></intensity_scale>
    <pointing_x type="float">1.0</pointing_x>
    <pointing_y type="float">0.0</pointing_y>
    <pointing_z type="float">0.0</pointing_z>
    <is_directional type="bool">false</is_directional>
    <is_strobe type="bool">false</is_strobe>
    <inner_angle type="float">0.707106781187</inner_angle>
    <outer_angle type="float">0.939692620786</outer_angle>
    <zero_angle type="float">0.017452406437</zero_angle>
    <outer_gain type="float">0.1</outer_gain>

    <visibility><use>/environment/ground-visibility-m</use></visibility>
    <avisibility><use>/environment/visibility-m</use></avisibility>
    <lthickness><use>/environment/ground-haze-thickness-m</use></lthickness>
    <terrain_alt><use>/environment/mean-terrain-elevation-m</use></terrain_alt>
    <eye_alt><use>/sim/rendering/eye-altitude-m</use></eye_alt>
    <terminator><use>/environment/terminator-relative-position-m</use></terminator>
  </parameters>

</PropertyList>


i think we can, if we ignore directionality, use the same few effects for each group of lights... i've not tested that yet but this would allow us to put the models as well as the effect files in AI/Lights and all models can use them... i'm not sure, but i think we can assign the effect to the model as soon as we load the model... that can all be done in the AI/Lights/NavLights.xml loader... then when we return from that to each individual craft's Lights/whatever-Lights.xml, we can do the scaling and positioning in there... i think...

we might even be able to put the nasal code into /AI/Lights/NavLights.xml so that it gets loaded from there... that will move more code to the ""shared library""... the problem there would be the timing of the blinks of the strobes and beacons... but there could be a default and we could override it, couldn't we?

anyway, i needed to share this... Richard on the dev mailing list gave me the HUGE pointer to the nasal code changes... the main one there being the use of cmdarg() to figure out where our current "working directory" is in the property tree... that one hint is what we've been searching for all this time!

so there it is... i think i can work up a package for testing if you or gooneybird want to take a look... you'll also need my KRDU airline traffic and ground net files plus all of the current AI craft changes... these are only for the ga craft i've been working with... i do have four other test craft that fly into KRDU but i've only got parking places for them right now until i go back through my traffic file and give them some flights... i want to do that slowly and see if/when some anomalies reappear with the new code...

OH and before i forget, hopefully someone can take the aircraft.light.new code and convert it to C code so we can then drop the nasal loader and use that new routine with xml markup to define the timings... then we can drop the nasal code or actually convert it to the new xml form if it is created for us...
Last edited by wkitty42 on Wed Aug 01, 2018 2:48 pm, edited 1 time in total.
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: animating AI PA-28 lights

Postby wkitty42 » Wed Aug 01, 2018 2:47 pm

@BecOzIcan:

i forgot to add, list night when i wrote the above, you really really really need to stop using directory traversal to get to the AI/Lights directory...

the following is bad
Code: Select all
    <path>../../../Lights/procedural_light_nav_right.xml</path>
    <path>../../../Lights/procedural_light_nav_left.xml</path>
    <path>../../../Lights/procedural_light_nav_tail.xml</path>
    <path>../../../Lights/procedural_light_strobe_right.xml</path>
    <path>../../../Lights/procedural_light_strobe_left.xml</path>
    <path>../../../Lights/procedural_light_strobe_tail.xml</path>


the following is good...
Code: Select all
    <path>AI/Lights/procedural_light_nav_right.xml</path>
    <path>AI/Lights/procedural_light_nav_left.xml</path>
    <path>AI/Lights/procedural_light_nav_tail.xml</path>
    <path>AI/Lights/procedural_light_strobe_right.xml</path>
    <path>AI/Lights/procedural_light_strobe_left.xml</path>
    <path>AI/Lights/procedural_light_strobe_tail.xml</path>
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: animating AI PA-28 lights

Postby BecOzIcan » Wed Aug 01, 2018 4:15 pm

wkitty42 wrote in Wed Aug 01, 2018 2:47 pm:@BecOzIcan:

i forgot to add, list night when i wrote the above, you really really really need to stop using directory traversal to get to the AI/Lights directory...


Done, Thanks
Ian
Current Projects: AI Traffic, Models & Liveries
User avatar
BecOzIcan
 
Posts: 1302
Joined: Tue Oct 04, 2011 11:43 pm
Location: Sydney, NSW, Australia
Version: 2020.4.0
OS: Win10

Re: animating AI PA-28 lights

Postby wkitty42 » Wed Aug 01, 2018 9:21 pm

cool! did you catch the code fix for nasal so we can stop polluting /sim/model with the various craft and their lighting property branch? i know you may not be using it but it is good information to know if we need it in the future ;)
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: animating AI PA-28 lights

Postby WoodSTokk » Wed Aug 01, 2018 11:49 pm

@wkitty42
Why do you control the lights via the effect?
Code: Select all
<intensity_scale type="float"><use>controls/lighting/beacons</use></intensity_scale>


I think you can also turn on/off via a select animation.
Code: Select all
<animation>
    <type>select</type>
    <object-name>BeaconGrouped</object-name>
    <condition>
        <property>controls/lighting/beacon</property>
    </condition>
</animation>


I don't know if the property will automaticaly taken from /ai/models/aircraft[n]/.
But i think there is a possibility for relative property path.
WoodSTokk
 
Posts: 1077
Joined: Tue Oct 17, 2017 3:30 pm
Location: Milky Way/Sol/Earth/Europe
Callsign: SX-W57
IRC name: WoodSTokk
Version: 2020.4.0
OS: Debian Bullseye

Re: animating AI PA-28 lights

Postby BecOzIcan » Thu Aug 02, 2018 4:05 am

wkitty42 wrote in Wed Aug 01, 2018 9:21 pm:cool! did you catch the code fix for nasal so we can stop polluting /sim/model with the various craft and their lighting property branch? i know you may not be using it but it is good information to know if we need it in the future ;)


Correct, I have no nasal at all in my newest code. Only touchpoint with /sim/model is reading the existing Transponder Value to trigger my beacons animation.
Current Projects: AI Traffic, Models & Liveries
User avatar
BecOzIcan
 
Posts: 1302
Joined: Tue Oct 04, 2011 11:43 pm
Location: Sydney, NSW, Australia
Version: 2020.4.0
OS: Win10

PreviousNext

Return to AI Traffic

Who is online

Users browsing this forum: No registered users and 1 guest