P3D v4 Turning Wheel, How to Start at Center of Animation?

#1
Hey all,

Trying to animate a small wheel that adjusts autopilot VSI control settings. I have an animation that is working, based on my old AC control knob. But I need it to start the animation at 50% or point 50 and go forwards/backwards from that point. Right now, it only starts at up and cannot go down. Goes up fine, then back down to zero point.

This is what I have so far. Right now, you'll note that its not linked yet in the actuation of AP VSI code yet. Right now just trying to get it to animate right.

Code....

Code:
  <PartInfo>
    <Name>learjet24_ap_vsi_thumbwheel</Name>
        <AnimLength>50</AnimLength>
    <Animation>
        <Parameter>
            <Code>
                (L:ap_vsi_thumbwheel, number)
            </Code>
        </Parameter>
    </Animation>
    <MouseRect>
        <Cursor>Hand</Cursor>
      <TooltipID>TOOLTIPTEXT_AUTOPILOT_VSI_INDICATOR_FTMIN</TooltipID>
        <MouseFlags>LeftSingle+LeftDrag+RightDrag+Wheel+RightSingle</MouseFlags>
        <CallbackCode>
            (M:Event) 'LeftSingle' scmp 0 ==
            if{ (M:X) (&gt;L:APVSI MPos, number)
                (L:ap_vsi_thumbwheel, number) 1 - (>L:ap_vsi_thumbwheel, number)
                }
            (M:Event) 'RightSingle' scmp 0 ==
            if{ (M:X) (&gt;L:APVSI MPos, number)
                (L:ap_vsi_thumbwheel, number) 1 + (>L:ap_vsi_thumbwheel, number)
                }
            (M:Event) 'LeftDrag' scmp 0 == (M:Event) 'RightDrag' scmp 0 == ||
                if{ (M:X) (L:APVSI MPos,number) - 3 + 0 &lt;
                if{ (L:ap_vsi_thumbwheel, number) 1 - (>L:ap_vsi_thumbwheel, number) (M:X) (&gt;L:APVSI MPos,number) }
 
                (M:X) (L:APVSI MPos,number) - 3 - 0 &gt;
                if{ (L:ap_vsi_thumbwheel, number) 1 + (>L:ap_vsi_thumbwheel, number) (M:X) (&gt;L:APVSI MPos,number) } }
            (M:Event) 'WheelUp' scmp 0 ==
            if{ (L:ap_vsi_thumbwheel, number) 1 + (>L:ap_vsi_thumbwheel, number) }
            (M:Event) 'WheelDown' scmp 0 ==
            if{ (L:ap_vsi_thumbwheel, number) 1 - (>L:ap_vsi_thumbwheel, number) }
            (L:ap_vsi_thumbwheel, number) 0 max 40 min (>L:ap_vsi_thumbwheel, number)
        </CallbackCode>
    </MouseRect>
</PartInfo>
 
#2
4 lines up from the bottom of your code...
XML:
 (L:ap_vsi_thumbwheel, number) 0 max 40 min (>L:ap_vsi_thumbwheel, number)
Since your dealing with 100 keyframes... That would kill it right in its tracks.
 
#4
Revised code with input for AP VS adjustment and sound. Working great except that the wheel starts out at the bottom of its animation. Go to give it up-VS setting and the wheel cannot turn.

Code:
  <PartInfo>
    <Name>learjet24_ap_vsi_thumbwheel</Name>
        <AnimLength>50</AnimLength>
    <Animation>
        <Parameter>
            <Code>
                (L:ap_vsi_thumbwheel, number)
            </Code>
        </Parameter>
    </Animation>
    <MouseRect>
        <Cursor>Hand</Cursor>
      <TooltipID>TOOLTIPTEXT_AUTOPILOT_VSI_INDICATOR_FTMIN</TooltipID>
        <MouseFlags>LeftSingle+LeftDrag+RightDrag+Wheel+RightSingle</MouseFlags>
        <CallbackCode>
            (M:Event) 'LeftSingle' scmp 0 ==
            if{ (M:X) (&gt;L:APVSI MPos, number)
                (L:ap_vsi_thumbwheel, number) 1 - (>L:ap_vsi_thumbwheel, number)
                1 (>L:XMLSND12,enum)
                   (&gt;K:AP_VS_VAR_INC)
                }
            (M:Event) 'RightSingle' scmp 0 ==
            if{ (M:X) (&gt;L:APVSI MPos, number)
                (L:ap_vsi_thumbwheel, number) 1 + (>L:ap_vsi_thumbwheel, number)
                1 (>L:XMLSND12,enum)
                   (&gt;K:AP_VS_VAR_DEC)
                }
            (M:Event) 'LeftDrag' scmp 0 == (M:Event) 'RightDrag' scmp 0 == ||
                if{ (M:X) (L:APVSI MPos,number) - 3 + 0 &lt;
                if{ (L:ap_vsi_thumbwheel, number) 1 - (>L:ap_vsi_thumbwheel, number) (M:X) (&gt;L:APVSI MPos,number)
                    (&gt;K:AP_VS_VAR_DEC)
                1 (>L:XMLSND12,enum)
                  }
                 (M:X) (L:APVSI MPos,number) - 3 - 0 &gt;
                if{ (L:ap_vsi_thumbwheel, number) 1 + (>L:ap_vsi_thumbwheel, number) (M:X) (&gt;L:APVSI MPos,number) } }
            (M:Event) 'WheelUp' scmp 0 ==
            if{
              (L:ap_vsi_thumbwheel, number) 1 + (>L:ap_vsi_thumbwheel, number)
                1 (>L:XMLSND12,enum)
                   (&gt;K:AP_VS_VAR_DEC)
              }
            (M:Event) 'WheelDown' scmp 0 ==
            if{
              (L:ap_vsi_thumbwheel, number) 1 - (>L:ap_vsi_thumbwheel, number)
                1 (>L:XMLSND12,enum)
                   (&gt;K:AP_VS_VAR_INC)
              }
            (L:ap_vsi_thumbwheel, number) 0 max 100 min (>L:ap_vsi_thumbwheel, number)
        </CallbackCode>
    </MouseRect>
</PartInfo>
 
#5
This should work..

1) Change anim length to 100 ( in the xml header too - <Animation name="blah blah blah" .... )
2) Bias the <Code> value to 50 ( + 50 )
3) Change the L:ap_vsi_thumbwheel limits to -50 & 50
4) Animate your knob / lever / whatever to : lower = 0 keyframes, middle = 50 keyframes, upper = 100 keyframes

XML:
.....
              <Animation name="learjet24_ap_vsi_thumbwheel" guid=" GUID " length="100" type="Sim" typeParam2="learjet24_ap_vsi_thumbwheel" typeParam="AutoPlay" />
.....
  <PartInfo>
    <Name>learjet24_ap_vsi_thumbwheel</Name>
        <AnimLength>100</AnimLength>
    <Animation>
        <Parameter>
            <Code>
                (L:ap_vsi_thumbwheel, number) 50 +
            </Code>
        </Parameter>
    </Animation>
.....
(L:ap_vsi_thumbwheel, number) -50 max 50 min (>L:ap_vsi_thumbwheel, number)
 
Top