- Messages
- 1,749
- Country
I decided i would design a working swash plate variable now that my coding is getting good. I can never find a code online. And maybe room for improvement by creating a smaller code. Any help on improvements one be awesome.
Besides the code being long for setting values the animation is exact real world operational.
Stoked!
This tutorial shows the butterfly mechanism and linkages to the rotor blades. Normally the splash plate is visible and would use this system as well. But the Moquito XE3 does not have a visible splash plate but rather a swivel joint and it uses internal push rods rather than external. So just use the same variable to animate your splash plate.
For joystick controls use the default fore/aft L/R controls....up to the splash plate then from there all parts would use the collective and the new custom variable.
Use the default collective A: variable:
lever_collective_arm
and this new swash plate L: variable.
Create an xml gauge and add entry to the panel CFG. Use the first VC cockpit entry so it always loads...
Gauge00=SWASHPLATE FOLDER!Update Swashplate, 0,0,2,2
This shows what parts get animated and which parts share both variables! You need to use keys 0 thru 100 then i create a key at 150 just to re center the parts then starting from key 200 is left and 250 is center with right being frame key 300. Assign both tags to the shared parts from the animation manager with keys 0-100 and 200-300
I used a test window to get the exact numbers to make the magic work!
Besides the code being long for setting values the animation is exact real world operational.
Stoked!
This tutorial shows the butterfly mechanism and linkages to the rotor blades. Normally the splash plate is visible and would use this system as well. But the Moquito XE3 does not have a visible splash plate but rather a swivel joint and it uses internal push rods rather than external. So just use the same variable to animate your splash plate.
For joystick controls use the default fore/aft L/R controls....up to the splash plate then from there all parts would use the collective and the new custom variable.
Use the default collective A: variable:
lever_collective_arm
and this new swash plate L: variable.
Code:
<PartInfo>
<Name>lever_stick_swashplate</Name>
<AnimLength>100</AnimLength>
<Animation>
<Parameter>
<Code>
(L:SWASHPLATE, Position) 50 * 50 +
</Code>
</Parameter>
</Animation>
</PartInfo>
Create an xml gauge and add entry to the panel CFG. Use the first VC cockpit entry so it always loads...
Gauge00=SWASHPLATE FOLDER!Update Swashplate, 0,0,2,2
Code:
<Update>
(A:ROTOR ROTATION ANGLE:1, Degrees) 0 > (A:ROTOR ROTATION ANGLE:1, Degrees) 180 < and if{
(A:YOKE X POSITION, Position) (>L:POSITION1, Position) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 180 > (A:ROTOR ROTATION ANGLE:1, Degrees) 360 < and if{
(A:YOKE X POSITION, Position) - (>L:POSITION1, Position) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 90 > (A:ROTOR ROTATION ANGLE:1, Degrees) 270 < and if{
(A:YOKE Y POSITION, Position) - (>L:POSITION2, Position) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 270 > (A:ROTOR ROTATION ANGLE:1, Degrees) 360 < and if{
(A:YOKE Y POSITION, Position) (>L:POSITION2, Position) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 0 > (A:ROTOR ROTATION ANGLE:1, Degrees) 90 < and if{
(A:YOKE Y POSITION, Position) (>L:POSITION2, Position) }
(L:POSITION1, Position) (>L:YOKE L/R POSITION, Position)
(L:POSITION2, Position) (>L:YOKE F/B POSITION, Position)
(A:ROTOR ROTATION ANGLE:1, Degrees) 0 > (A:ROTOR ROTATION ANGLE:1, Degrees) 5 < and if{ 0.9 (>L:VALUEA, Number) 0.0 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 5 > (A:ROTOR ROTATION ANGLE:1, Degrees) 15 < and if{ 0.8 (>L:VALUEA, Number) 0.1 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 15 > (A:ROTOR ROTATION ANGLE:1, Degrees) 25 < and if{ 0.7 (>L:VALUEA, Number) 0.2 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 25 > (A:ROTOR ROTATION ANGLE:1, Degrees) 35 < and if{ 0.6 (>L:VALUEA, Number) 0.3 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 35 > (A:ROTOR ROTATION ANGLE:1, Degrees) 45 < and if{ 0.5 (>L:VALUEA, Number) 0.4 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 45 > (A:ROTOR ROTATION ANGLE:1, Degrees) 55 < and if{ 0.4 (>L:VALUEA, Number) 0.5 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 55 > (A:ROTOR ROTATION ANGLE:1, Degrees) 65 < and if{ 0.3 (>L:VALUEA, Number) 0.6 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 65 > (A:ROTOR ROTATION ANGLE:1, Degrees) 75 < and if{ 0.2 (>L:VALUEA, Number) 0.7 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 75 > (A:ROTOR ROTATION ANGLE:1, Degrees) 85 < and if{ 0.1 (>L:VALUEA, Number) 0.8 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 85 > (A:ROTOR ROTATION ANGLE:1, Degrees) 95 < and if{ 0.0 (>L:VALUEA, Number) 0.9 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 95 > (A:ROTOR ROTATION ANGLE:1, Degrees) 105 < and if{ 0.1 (>L:VALUEA, Number) 0.8 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 105 > (A:ROTOR ROTATION ANGLE:1, Degrees) 115 < and if{ 0.2 (>L:VALUEA, Number) 0.7 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 115 > (A:ROTOR ROTATION ANGLE:1, Degrees) 125 < and if{ 0.3 (>L:VALUEA, Number) 0.6 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 125 > (A:ROTOR ROTATION ANGLE:1, Degrees) 135 < and if{ 0.4 (>L:VALUEA, Number) 0.5 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 135 > (A:ROTOR ROTATION ANGLE:1, Degrees) 145 < and if{ 0.5 (>L:VALUEA, Number) 0.4 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 145 > (A:ROTOR ROTATION ANGLE:1, Degrees) 155 < and if{ 0.6 (>L:VALUEA, Number) 0.3 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 155 > (A:ROTOR ROTATION ANGLE:1, Degrees) 165 < and if{ 0.7 (>L:VALUEA, Number) 0.2 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 165 > (A:ROTOR ROTATION ANGLE:1, Degrees) 175 < and if{ 0.8 (>L:VALUEA, Number) 0.1 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 175 > (A:ROTOR ROTATION ANGLE:1, Degrees) 185 < and if{ 0.9 (>L:VALUEA, Number) 0.0 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 185 > (A:ROTOR ROTATION ANGLE:1, Degrees) 195 < and if{ 0.8 (>L:VALUEA, Number) 0.1 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 195 > (A:ROTOR ROTATION ANGLE:1, Degrees) 205 < and if{ 0.7 (>L:VALUEA, Number) 0.2 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 205 > (A:ROTOR ROTATION ANGLE:1, Degrees) 215 < and if{ 0.6 (>L:VALUEA, Number) 0.3 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 215 > (A:ROTOR ROTATION ANGLE:1, Degrees) 225 < and if{ 0.5 (>L:VALUEA, Number) 0.4 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 225 > (A:ROTOR ROTATION ANGLE:1, Degrees) 235 < and if{ 0.4 (>L:VALUEA, Number) 0.5 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 235 > (A:ROTOR ROTATION ANGLE:1, Degrees) 245 < and if{ 0.3 (>L:VALUEA, Number) 0.6 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 245 > (A:ROTOR ROTATION ANGLE:1, Degrees) 255 < and if{ 0.2 (>L:VALUEA, Number) 0.7 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 255 > (A:ROTOR ROTATION ANGLE:1, Degrees) 265 < and if{ 0.1 (>L:VALUEA, Number) 0.8 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 265 > (A:ROTOR ROTATION ANGLE:1, Degrees) 275 < and if{ 0.0 (>L:VALUEA, Number) 0.9 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 275 > (A:ROTOR ROTATION ANGLE:1, Degrees) 285 < and if{ 0.1 (>L:VALUEA, Number) 0.8 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 285 > (A:ROTOR ROTATION ANGLE:1, Degrees) 295 < and if{ 0.2 (>L:VALUEA, Number) 0.7 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 295 > (A:ROTOR ROTATION ANGLE:1, Degrees) 305 < and if{ 0.3 (>L:VALUEA, Number) 0.6 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 305 > (A:ROTOR ROTATION ANGLE:1, Degrees) 315 < and if{ 0.4 (>L:VALUEA, Number) 0.5 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 315 > (A:ROTOR ROTATION ANGLE:1, Degrees) 325 < and if{ 0.5 (>L:VALUEA, Number) 0.4 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 325 > (A:ROTOR ROTATION ANGLE:1, Degrees) 335 < and if{ 0.6 (>L:VALUEA, Number) 0.3 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 335 > (A:ROTOR ROTATION ANGLE:1, Degrees) 345 < and if{ 0.7 (>L:VALUEA, Number) 0.2 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 345 > (A:ROTOR ROTATION ANGLE:1, Degrees) 355 < and if{ 0.8 (>L:VALUEA, Number) 0.1 (>L:VALUEB, Number) }
(A:ROTOR ROTATION ANGLE:1, Degrees) 355 > (A:ROTOR ROTATION ANGLE:1, Degrees) 360 < and if{ 0.9 (>L:VALUEA, Number) 0.0 (>L:VALUEB, Number) }
(L:YOKE L/R POSITION, Position) (L:VALUEB, Number) * (>L:VALUE1, Position)
(L:YOKE F/B POSITION, Position) (L:VALUEA, Number) * (>L:VALUE2, Position)
(L:VALUE1, Position) (L:VALUE2, Position) + (>L:SWASHPLATE, Position)
</Update>
This shows what parts get animated and which parts share both variables! You need to use keys 0 thru 100 then i create a key at 150 just to re center the parts then starting from key 200 is left and 250 is center with right being frame key 300. Assign both tags to the shared parts from the animation manager with keys 0-100 and 200-300
I used a test window to get the exact numbers to make the magic work!
Last edited: