Military AI Works • Need help with Elevator XML
Page 1 of 1

Need help with Elevator XML

Posted: 05 Feb 2018, 15:42
by gavinc
Hi Folks
Can someone who knows more about xml than me (ie everyone) give me a hand?
I am converting the NBAI F-22 to P3D and need a bit of assistance with the tail surfaces.

Nick modeled the engine outlets that move along with the tail.
Image

I would also like to model the tail droop when the aircraft is parked (like this)
Image

This bit of code works great for the moving tail

<PartInfo>
<Name>elevator_key</Name>
<AnimLength>100</AnimLength>
<Animation>
<Parameter>
<Sim>
<Variable>ELEVATOR DEFLECTION</Variable>
<Units>grads</Units>
<Bias>50</Bias>
</Sim>
</Parameter>
</Animation>
</PartInfo>


and this bit of code works great to droop the tail when parked
<Name>custom_anim_F16_Elevator</Name>
<AnimLength>100</AnimLength>
<Animation>
<Parameter>
<Code>
(A:GROUND VELOCITY,knots) 0 !=
(A:LIGHT BEACON,bool) or
if{ A:ELEVATOR DEFLECTION PCT, percent) -0.5 * 50 + }
els{ (A:ELEVATOR DEFLECTION PCT, percent)}
</Code>
<Lag>30</Lag>
</Parameter>
</Animation>
</PartInfo>

My problem is trying to combine them.

All help gratefully received.

thanks
Gavin

Re: Need help with Elevator XML

Posted: 05 Feb 2018, 16:00
by Firebird
I am a big fan of the KISS principal so my initial thought is if both bits of code work as you want them to, why combine them to make one complicated statement that could be troublesome to troubleshoot?

Are you trying to get the engine outlets to droop as well on the ground?

I realise that I could be being thick today in not seeing an issue.

Re: Need help with Elevator XML

Posted: 05 Feb 2018, 17:21
by clickclickdoh
Firebird wrote: 05 Feb 2018, 16:00Are you trying to get the engine outlets to droop as well on the ground?
FYI: If this is the case, the F-22 vectored thrust nozzles don't droop when the jet is cold. They spread.

Re: Need help with Elevator XML

Posted: 05 Feb 2018, 19:45
by gavinc
Firebird wrote: 05 Feb 2018, 16:00 I am a big fan of the KISS principal so my initial thought is if both bits of code work as you want them to, why combine them to make one complicated statement that could be troublesome to troubleshoot?

Are you trying to get the engine outlets to droop as well on the ground?

I realise that I could be being thick today in not seeing an issue.
Sorry - not making myself clear. I can use one set of code or the other.

Nicks FS9 model just had the moving elevators, when parked they were level. I am trying to add the droop when parked.

Gavin

Re: Need help with Elevator XML

Posted: 05 Feb 2018, 21:08
by Weescotty
Try this....

<PartInfo>
<Name>custom_anim_F16_Elevator</Name>
<AnimLength>100</AnimLength>
<Animation>
<Parameter>
<Code>
(A:LIGHT BEACON,bool) !
if{ <DROOP KEYFRAME NUMBER HERE> }
else{ (A:ELEVATOR DEFLECTION PCT,percent) }
</Code>
<Lag>30</Lag>
</Parameter>
</Animation>
</PartInfo>


Info...
(A:LIGHT BEACON,bool) ! - Makes the beacon off condition TRUE
if{ <DROOP KEYFRAME NUMBER HERE> } - If TRUE (beacon off) goto parked keyframe
else{ (A:ELEVATOR DEFLECTION PCT,percent) } - If FALSE (beacon on) use the actual elevator postion.

Not sure why the -0.5 * 50 + is needed on the original code.

Re: Need help with Elevator XML

Posted: 06 Feb 2018, 14:45
by gavinc
Thanks Weescotty
that worked. I needed to add the -0.5 * 50 back in for the elevators to come back to the neutral position when the lights came on.

Now on to the next challenge.

Gavin

Re: Need help with Elevator XML

Posted: 06 Feb 2018, 20:03
by Weescotty
That -0.5 * 50 + shouldn't be needed.

Try adding a keyframe at 50 with the elevators level and this slightly modded code....

<PartInfo>
<Name>custom_anim_F16_Elevator</Name>
<AnimLength>100</AnimLength>
<Animation>
<Parameter>
<Code>
(A:LIGHT BEACON,bool) !
if{ <DROOP KEYFRAME NUMBER HERE> }
else{ (A:ELEVATOR DEFLECTION PCT,percent) }
</Code>
<Bias>50</Bias>
<Lag>30</Lag>
</Parameter>
</Animation>
</PartInfo>

<Bias>50</Bias> - tells it the 'default' position for the animation is keyframe 50.
They should also function as elevators when the aircraft is flying.