• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FS2004 Looping animations for Ai Aircraft

Messages
15
Hey guys. I intend to do a looping animation for my upcoming AI E3A sentry.
The idea is that the radar should start rotating after clearing a certain altitude (FL150).

This is the code I found and having tested it I know it works, and the animation does stop after dropping below said altitude but I have a couple of issues with it:

Code:
<part>
  <name>sentry_radome</name>
   <animation>
     <rotation>Z</rotation>
    <parameter>
      <code>
         (A:Indicated Altitude,feet) 15000 &gt;
         if{ (E:ABSOLUTE TIME, second) 360 * dgrd } els{ 0 }
      </code>
    </parameter>
   </animation>
</part>

1. I'm not sure if adding lag tags to this code will slow the animations down since the part is not animated by keyframes. Is there a way to implement this animation with keyframes, or to slow the animation down by alternative methods?

2. The problem with this code is that when animation stops the radar is reset to the position it holds at keyframe 0. Is there a way for the animation to stop while holding the current keyframe (if it were animated that way) much like the real radar would in real life? AWACS radars are not set to any particular position when taking off or landing, rather their rotation is powered off and they remain in place, and this is the behaviour I seek to replicate. Don't know if that makes any sense.

Thanks beforehand for your time and help.
 
This will address point 2
Code:
<part>
  <name>sentry_radome</name>
   <animation>
     <rotation>Z</rotation>
    <parameter>
      <code>
         (A:Indicated Altitude,feet) 15000 &gt;
            if{ (E:ABSOLUTE TIME, second) 360 * dgrd  d (>L:Radar,degrees) } 
            els{ (L:Radar,degrees) }
      </code>
    </parameter>
   </animation>
</part>

Ted.
 
1. I'm not sure if adding lag tags to this code will slow the animations down since the part is not animated by keyframes. Is there a way to implement this animation with keyframes, or to slow the animation down by alternative methods?

Try animating the part by rotating it and adding a keyframe every 90 degrees so that a complete rotation takes something like 100 keyframes.

Then try this code:
Code:
<part>
<name>radome</name>
	<animation>
		<parameter>
			<code>
		(A:Indicated Altitude,feet) 15000 &gt;
	      if{ (L:RADOME ROT,number) 0.1 + 100 % d (&gt;L:RADOME ROT,number) }	
			</code>
		</parameter>
	</animation>
</part>

This should, in theory, trigger an endlessly looping animation when the plane is above 15000 ft. You can control the rotation speed by altering the "0.1" value.
Keep in mind that the animation is dependent on the simulator framerate, i.e. it diplays slower if the framerate is lower and vice versa.
I'd trim the animation speed for the rotation speed of the real E-3's radome and a framerate target of 30 or so.



- E: Cut out superfluous "}".
 
Last edited:
I'm afraid that didn't work Bjoern. I'll try Ted's code and if it works then we're one step closer to the solution. ;)

E: Nope, Ted's code doesn't work, radar resets once condition isn't met.
 
Last edited:
Including L:Vars in the scripts won't work as AI MDLs don't support their use.
You could try instead with G:Vars, like

Code:
      <code>
         (A:Indicated Altitude,feet) 15000 &gt;
            if{ (E:ABSOLUTE TIME, second) 360 * dgrd  d (>G:Var1) } 
            els{ (G:Var1) }
      </code>

Tom
 
I'm afraid that didn't work Bjoern.

There was a superfluous "}" in it.



And considering Tom's input...

Code:
<part>
<name>radome</name>
	<animation>
		<parameter>
			<code>
		(A:Indicated Altitude,feet) 15000 &gt;
	      if{ (G:Var1) 0.1 + 100 % d (G:Var1) }	
			</code>
		</parameter>
	</animation>
</part>
 
^
@Heretic, this code is good for gauges, but I think that mdl-parts code must have P:Time variable, because unlike gauges where execution is at 18Hz, for mdl-parts execution depends on the FPS, so the rotation speed will not be constant.
 
I've mentioned this in my last post...



Another possible way to do this:
- Radome with "Tick18" animation*
- Static radome

Each visibility coded to appear above or below 15000 ft.



*That was the "do stuff continuously" animation tag for FS9, right?
 
I tried your newest code and the didn't work either. It seemed as if it just animated for 1 or 2 keyframes and then just stopped.

Another possible way to do this:
- Radome with "Tick18" animation*
- Static radome

Each visibility coded to appear above or below 15000 ft.

The problem with this approach is that the radar would always jump to its non-animated state which would be always the same, always pointing in the same direction.

What I want is for the radar to preserve its last animation keyframe, so that it always has a different position when landing, like a real E3A would.

-E: The code with Tom's revision works -and addresses- point 2. I'll have to play around with it to find a way to slow it down, and also to see if this will work with LODs.
 
Last edited:
Have you tried using key frames o to 1024. That way it should'nt reset to the orgional position until it has landed and parked.

James
 
Back
Top