Hi all,
I'm currently trying to animate wipers.
I've managed to create the animation for them, but it's the getting them to work that I'm struggling with.
This is the code I have in my modeldef.xml file for the wiper knob (left wiper only):
That and the associated animation for the left wiper knob are working like a charm.
I also have the following code in my modeldef.xml for the wiper blades:
And the code from my .xanim file:
No cigar.
I've used the following pages for reference:
https://www.fsdeveloper.com/forum/threads/3-speed-wipers.93549/#post-247354
http://www.aerodynamika.com/cgi-bin/yabb2/YaBB.pl?num=1193457453
https://www.fsdeveloper.com/forum/threads/not-sure-if-fsx-or-fsxa.441972/page-2
I just can't figure this out. I'd very much appreciate if anyone can help me understand where I'm going wrong.
To be clear, the above is 'test code'. All I want to do for now is have the left wipers animate when the left wiper knob is not at the 0 setting (ie. 1, 2 or 3). I'll add in multiple speed wipers when I can get my head around the concept of ambient animation.
Ta!
Trent
I'm currently trying to animate wipers.
I've managed to create the animation for them, but it's the getting them to work that I'm struggling with.
This is the code I have in my modeldef.xml file for the wiper knob (left wiper only):
Code:
<PartInfo>
<Name>knob_Wiper_left</Name>
<AnimLength>50</AnimLength>
<Animation>
<Parameter>
<Code>
(L:Wiper Left, enum) 0 == if{ 0 }
(L:Wiper Left, enum) 1 == if{ 16 }
(L:Wiper Left, enum) 2 == if{ 32 }
(L:Wiper Left, enum) 3 == if{ 50 }
</Code>
<Lag>400</Lag>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<MouseFlags>LeftSingle+RightSingle+WheelUp+WheelDown</MouseFlags>
<CallbackCode>
(M:Event) 'RightSingle' scmp 0 ==
(M:Event) 'WheelUp' scmp 0 == or
if{ (L:Wiper Left, enum) ++ s0 3 > if{ 3 } els{ l0 } (>L:Wiper Left, enum) }
(M:Event) 'LeftSingle' scmp 0 ==
(M:Event) 'WheelDown' scmp 0 == or
if{ (L:Wiper Left, enum) -- s0 0 < if{ 0 } els{ l0 } (>L:Wiper Left, enum) }
</CallbackCode>
</MouseRect>
</PartInfo>
That and the associated animation for the left wiper knob are working like a charm.
I also have the following code in my modeldef.xml for the wiper blades:
Code:
<Animation name="NonRandomAmbient" guid="94c95bf8-907a-483c-99fe-968825034c40" length="100" type="Sim" typeParam2="NonRandomAmbient" typeParam="AutoPlay" />
<Animation name="NonRandomAmbient1" guid="bb7a2358-b3f2-4bbd-843a-5070afdc794c" length="100" type="Sim" typeParam2="NonRandomAmbient1" typeParam="AutoPlay" />
<PartInfo>
<Name>NonRandomAmbient</Name>
<Visibility>
<Parameter>
<Code>
(L:Wiper Left, enum) 0 !=
</Code>
</Parameter>
</Visibility>
</PartInfo>
<PartInfo>
<Name>NonRandomAmbient1</Name>
<Visibility>
<Parameter>
<Code>
(L:Wiper Left, enum) 0 !=
</Code>
</Parameter>
</Visibility>
</PartInfo>
And the code from my .xanim file:
Code:
<Anim name="NonRandomAmbient" guid="94c95bf8-907a-483c-99fe-968825034c40" length="100.000" type="Sim" typeParam="AutoPlay" typeParam2="NonRandomAmbient">
<AnimStream name="Position" id="2" partName="node08" length="100.000">
<Keyframe time="0.000" type="Vector" data="0.000000;0.000000;0.000000;0.000000"/>
<Keyframe time="25.000" type="Vector" data="0.000000;0.000000;0.000000;0.000000"/>
<Keyframe time="50.000" type="Vector" data="0.000000;0.000000;0.000000;0.000000"/>
<Keyframe time="75.000" type="Vector" data="0.000000;0.000000;0.000000;0.000000"/>
<Keyframe time="100.000" type="Vector" data="0.000000;0.000000;0.000000;0.000000"/>
</AnimStream>
<AnimStream name="Rotation" id="0" partName="node08" length="100.000">
<Keyframe time="0.000" type="Quaternion" data="0;0;0;1"/>
<Keyframe time="25.000" type="Quaternion" data="-0.114806;0.337664;0.084416;0.930418"/>
<Keyframe time="50.000" type="Quaternion" data="-0.213634;0.628336;0.157084;0.731354"/>
<Keyframe time="75.000" type="Quaternion" data="-0.114806;0.337664;0.084416;0.930418"/>
<Keyframe time="100.000" type="Quaternion" data="0;0;0;1"/>
</AnimStream>
</Anim>
<Anim name="NonRandomAmbient1" guid="bb7a2358-b3f2-4bbd-843a-5070afdc794c" length="100.000" type="Sim" typeParam="AutoPlay" typeParam2="NonRandomAmbient1">
<AnimStream name="Position" id="2" partName="node10" length="100.000">
<Keyframe time="0.000" type="Vector" data="0.000000;0.000000;0.000000;0.000000"/>
<Keyframe time="25.000" type="Vector" data="0.000000;0.000000;0.000000;0.000000"/>
<Keyframe time="50.000" type="Vector" data="0.000000;0.000000;0.000000;0.000000"/>
<Keyframe time="75.000" type="Vector" data="0.000000;0.000000;0.000000;0.000000"/>
<Keyframe time="100.000" type="Vector" data="0.000000;0.000000;0.000000;0.000000"/>
</AnimStream>
<AnimStream name="Rotation" id="0" partName="node10" length="100.000">
<Keyframe time="0.000" type="Quaternion" data="0;0;0;1"/>
<Keyframe time="25.000" type="Quaternion" data="0;0;-0.087156;-0.996195"/>
<Keyframe time="50.000" type="Quaternion" data="0;0;-0.173648;-0.984808"/>
<Keyframe time="75.000" type="Quaternion" data="0;0;-0.087156;-0.996195"/>
<Keyframe time="100.000" type="Quaternion" data="0;0;0;1"/>
</AnimStream>
</Anim>
No cigar.
I've used the following pages for reference:
https://www.fsdeveloper.com/forum/threads/3-speed-wipers.93549/#post-247354
http://www.aerodynamika.com/cgi-bin/yabb2/YaBB.pl?num=1193457453
https://www.fsdeveloper.com/forum/threads/not-sure-if-fsx-or-fsxa.441972/page-2
I just can't figure this out. I'd very much appreciate if anyone can help me understand where I'm going wrong.
To be clear, the above is 'test code'. All I want to do for now is have the left wipers animate when the left wiper knob is not at the 0 setting (ie. 1, 2 or 3). I'll add in multiple speed wipers when I can get my head around the concept of ambient animation.
Ta!
Trent







