|
From: Fahim D. <dal...@gm...> - 2020-08-21 18:45:01
|
Hello all,
I stumbled upon this bug/issue when trying to add a flashing light to a commercial tower that I am modeling. As I found out through some helpful discussions on discord, there are two ways in which flashing lights have been implemented:
timed animation type: this is what the wiki articles point to, and also used in $FGDATA/Models/Effects/strobe10000.xml which I took as my "official reference” since its in the core package
select animation type with _lots_ of “or” conditions checking /sim/time/real/second (so true when second == 1,2,4,5,7,8…) which is what some shared structures like windmills use
The timed animation specifically was not working for me, even $FGDATA/Models/Effects/strobe10000.xml which I assumed should work out of the box. Placing it using the UFO would result in a light thats always on, not flashing/strobing. What follows is a slightly long email of my findings, so apologies for the length beforehand.
After a lot of investigation, it turns out that the order of the “timed” animation was crucial, and I could not find any reference for this specific animation. I will add the findings to the wiki once they are confirmed by someone here. The “timed” animation uses two objects, one with the light texture and one blank object, and switches between the two. Let us call these objects “LIGHT” and “BLANK” respectively. For brevity, consider the following shorthands:
anim_timed_both:
<animation>
<type>timed</type>
<object-name>LIGHT</object-name>
<object-name>BLANK</object-name>
<use-personality type="bool">true</use-personality>
<branch-duration-sec>1</branch-duration-sec>
<branch-duration-sec>2</branch-duration-sec>
</animation>
billboard_single:
<animation>
<type>billboard</type>
<object-name>LIGHT</object-name>
<spherical type="bool">true</spherical>
</animation>
billboard_both:
<animation>
<type>billboard</type>
<object-name>LIGHT</object-name>
<object-name>BLANK</object-name>
<spherical type="bool">true</spherical>
</animation>
noshadow_single:
<animation>
<type>noshadow</type>
<object-name>LIGHT</object-name>
</animation>
noshadow_both:
<animation>
<type>noshadow</type>
<object-name>LIGHT</object-name>
<object-name>BLANK</object-name>
</animation>
Now, the following xml configuration options result in a flashing light:
anim_timed_both —> billboard_single —> noshadow_single
anim_timed_both —> noshadow_single —> billboard_single
noshadow_both —> billboard_both —> anim_timed_both
billboard_both —> noshadow_both —> anim_timed_both
The following configurations lead to a static non-flashing light (i.e. timed animation not working):
billboard_single —> noshadow_single —> anim_timed_both
noshadow_single —> billboard_single —> anim_timed_both
billboard_single —> noshadow_both —> anim_timed_both
billboard_both —> noshadow_single —> anim_timed_both
noshadow_single —> billboard_both —> anim_timed_both
noshadow_both —> billboard_single —> anim_timed_both
anim_timed_both —> billboard_both —> noshadow_both
anim_timed_both —> noshadow_both —> billboard_both
anim_timed_both —> billboard_both —> noshadow_single
anim_timed_both —> billboard_single —> noshadow_both
anim_timed_both —> noshadow_both —> billboard_single
anim_timed_both —> noshadow_single —> billboard_both
The last six are particularly concerning; because it implies that it is not a safe thing to “include both always”. To me it implies that if I want some animation on both objects (say noshadow), I _have_ to add it before the timed animation, and if I do not want some animation for both objects, I _have_ to add it after the timed animation.
Does anyone have any insights into this? Is this expected behavior? I only tested with noshadow/billboard, but other animations possibly have some similar strange interactions. Is it possible to properly define what order things should/should not occur? This is also most likely a regression at some point, because presumably whoever wrote $FGDATA/Models/Effects/strobe10000.xml made sure it was working back then.
On a side note, we should also fix $FGDATA/Models/Effects/strobe10000.xml. Two ways to do this, add “BLANK” to noshadow animation, or move noshadow animation block after timed animation block.
Thanks and looking forward to some insights.
Best,
Fahim
|