- Messages
- 531
- Country
Hello experts,
I am not an expert in virtual cockpit animations and I am facing a problem that I believe is very common:
I created an animation for a rotating knob that controls a local variable that varies from 0 to 359 degrees, and like the HEADING or COURSE knob in many cockpits, it can turn endlessly in both directions. Turning clockwise increases the value and when the value reaches 360, it is reset to 0 and can keep increasing. Same for anticlockwise, decreasing.
The XML code in the interior model file looks like this:
It works well, but... When I turn the knob clockwise using the mouse wheel and reach the value of 359, increasing once more resets it to 0. The value is correct, but the animation is wrong because the knob turns counterclockwise to reflect the value of 0. It is the same the other when I decrease and reach the value of 0, decreasing again sets the value to 359 and the animation is wrong.
The strange thing is that if I use the mouse button of the left/right of the knob to decrease/increase the value, everything works perfectly.
I am sure it is a common problem some of you already had, I am sure there is solution.
Thanks for any help,
Eric
I am not an expert in virtual cockpit animations and I am facing a problem that I believe is very common:
I created an animation for a rotating knob that controls a local variable that varies from 0 to 359 degrees, and like the HEADING or COURSE knob in many cockpits, it can turn endlessly in both directions. Turning clockwise increases the value and when the value reaches 360, it is reset to 0 and can keep increasing. Same for anticlockwise, decreasing.
The XML code in the interior model file looks like this:
<Component ID="MyCompenentID" Node="MyNode">
<Update Frequency="2.0">
(O:IsInit) ! if{ 1 (>O:IsInit) 0 (>L:MyLocalVariable, number) }
</Update>
<UseTemplate Name="ASOBO_GT_Knob_Finite_Code">
<ANIM_NAME>My_Rotating_Knob</ANIM_NAME>
<ANIM_CODE>(L:MyLocalVariable, number) 1 *</ANIM_CODE>
<ANIMTIP_0>OFF</ANIMTIP_0>
<ANIMTIP_1>AUTO</ANIMTIP_1>
<ANIMTIP_2>ON</ANIMTIP_2>
<ANIM_LENGTH>360</ANIM_LENGTH>
<CLOCKWISE_CODE>
(L:MyLocalVariable, number) ++ d 359 > if{ 0 } (>L:MyLocalVariable, number)
</CLOCKWISE_CODE>
<ANTICLOCKWISE_CODE>
(L:MyLocalVariable, number) -- d 0 < if{ 359 } (>L:MyLocalVariable, number)
</ANTICLOCKWISE_CODE>
</UseTemplate>
</Component>
It works well, but... When I turn the knob clockwise using the mouse wheel and reach the value of 359, increasing once more resets it to 0. The value is correct, but the animation is wrong because the knob turns counterclockwise to reflect the value of 0. It is the same the other when I decrease and reach the value of 0, decreasing again sets the value to 359 and the animation is wrong.
The strange thing is that if I use the mouse button of the left/right of the knob to decrease/increase the value, everything works perfectly.
I am sure it is a common problem some of you already had, I am sure there is solution.
Thanks for any help,
Eric