Mouse Controlling Ailerons and Rudder; Dual Mouse-Drag

#1
Hey all,

Is it possible... to make 'Mouse Drag' work two different controls in two different motion 'directions'?

Example; Left Ailerons and Right Ailerons using Mouse 'LeftDrag'?

I have it working with LeftDrag and RightDrag just fine, but wondered... What if you could 'move the mouse left drag' to the left and it operates the left direction input of ailerons, and if you move it back to the right, not taking your finger off the mouse click drag 'moment', you move the ailerons 'back' the other way via Aileron_Right command.

Is it possible?


This is what I have right now... Mouse wheel manages elevators. Right drag is right aileron. Left drag is left aileron.


Code:
// JOYSTICK FLY BY WIRE TEST
<Area Left="610" Top="440" Right="870" Bottom="620">
       <Visible>(L:TIER2 CLICK LAYER,enum) 0 == </Visible>
          <Tooltip>AUX FLIGHT CONTROL</Tooltip>
          <Cursor Type="Hand"/>
          <Click Kind="LeftDrag+RightDrag+WheelUp+WheelDown">
          (M:Event) 'LeftDrag' scmp 0 ==
             if{ 1 (&gt;L:XMLSND61,enum)
                    (>K:AILERONS_LEFT) }
          (M:Event) 'RightDrag' scmp 0 ==
             if{ 1 (&gt;L:XMLSND61,enum)
                    (>K:AILERONS_RIGHT) }
          (M:Event) 'WheelUp' scmp 0 ==
             if{ 1 (&gt;L:XMLSND61,enum)
                    (>K:ELEV_DOWN) }
          (M:Event) 'WheelDown' scmp 0 ==
             if{ 1 (&gt;L:XMLSND61,enum)
                    (>K:ELEV_UP) }
     </Click>
    </Area>
This is for those quick test flights when you dont want to break out the joystick and throttle quad to do a quick test flight and you are tired of crashing because you cannot maneuver well enough with the keyboard arrow keys...

Would be REALLY cool if you could do all four axis for all four directions. Slide upwards and you have down elevator. Slide downwards and you are pulling back. Left and right for left and right elevator.
 
#2
I think yes, I remember when doing try and error on VC Osprey mirror. I have 2 direction with mouse drag (x), I think it can combine with Y axis. I not continue it cause the mirror doesn't give reflection at all (gauge camera only work in P3D)
in that case it was Lvars, but the basic command is similar if use EVENT ID

add note:
it was XML code in modeldef.xml
 

ddawson

Resource contributor
#3
Bill,
As an alternative, get yourself a small-ish game pad. It wouldn't take up a lot of space on your desk, but would give you the axis control required to make credible test flights.
 
#4
This is a xml-gauge von Herbert Pralle, 2007

Code:
<Gauge Name="Mouse Control" Version="1.0" Author="Herbert Pralle">
  <Image Name="Mouse_Control_Backgrnd.bmp"/>
  <Mouse>
    <Area Left="5" Width="190" Top="10" Height="190">
      <Cursor Type="Hand"/>
      <Click Kind="LeftSingle+LeftDrag">
            (M:Y) 100 - 100 / -1 max 1 min -16384.0 * (>K:ELEVATOR_SET) 
            (M:X) 100 - 100 / -1 max 1 min -16384.0 * (>K:AILERON_SET)
     </Click>
      <Tooltip>Click and drag</Tooltip>
    </Area>
    <Area Left="180" Width="20" Top="0" Height="20">
      <Cursor Type="Hand"/>
      <Click>0 (>K:ELEVATOR_SET) 0 (>K:AILERON_SET)</Click>
      <Tooltip>Center ailerons and elevators</Tooltip>
    </Area>
  </Mouse>
</Gauge>
 

Attachments

#6
Bill,
As an alternative, get yourself a small-ish game pad. It wouldn't take up a lot of space on your desk, but would give you the axis control required to make credible test flights.
What I want though is to be able to mouse control the plane in the plane, not the keyboard or controls or gamepad. ;)
 
#8
Playing around with the code. Very interesting how it works. I tried a variety of things to do different stuff. I changed the mouse input to 50 instead of 100 (mousedragging). A bit sensitive on my plane. Also tried implementing mouse wheel for elevators only. You needed tons of mouse wheel input. I should try the 100 - 100 setting for 'set' of elevator with mouse wheel and see how that does. But anyways, on this one, you get to reset elevators, rudder and ailerons to zero with a right click on this version.

Code:
// JOYSTICK FLY BY WIRE TEST
<Area Left="610" Top="440" Right="870" Bottom="620">
       <Visible>(L:TIER2 CLICK LAYER,enum) 0 == </Visible>
          <Tooltip>AUX FLIGHT CONTROL</Tooltip>
      <Cursor Type="Hand"/>
      <Click Kind="LeftSingle+LeftDrag+RightSingle">
            (M:Y) 50 - 50 / -1 max 1 min -16384.0 * (>K:ELEVATOR_SET)
            (M:X) 50 - 50 / -1 max 1 min -16384.0 * (>K:AILERON_SET)
            (M:Event) 'RightSingle' scmp 0 == 
             if{ 0 (>K:ELEVATOR_SET) 0 (>K:AILERON_SET) 0 (>K:RUDDER_SET) }
     </Click>
      <Tooltip>Click and drag</Tooltip>
    </Area>
 
#9
You could do it also this way:
To multiply -1 to 1 by 0.5 or 0.6 or....
So you get half of the max control settings.
You can change 0.5 to any number or even to function.
It's up to you what you need! It's your playground.

Code:
            (M:Y) 100 - 100 / -1 max 1 min   0.5 *   -16384.0 * (>K:ELEVATOR_SET)
            (M:X) 100 - 100 / -1 max 1 min   0.5 *   -16384.0 * (>K:AILERON_SET)
 

Roy Holmes

Resource contributor
#10
You realize that centering the controls does not always cause the airplane to fly level. That will only happen if the trim settings are correct. Since you make no mention of trim you will only fly level by good fortune or sly cunning.
Roy
 
#11
Interesting.. Thanks EduHir. I'll try that out.

Roger that Roy. I knew that, but in this case, if you do not click dead center of the click zone, you lurch out in an extreme direction. Its interesting how it works. Im not complaining, just trying to tune it in a bit, tame it down.
 
#12
Of course yon can extend this code!
If you change the elevator you can change the trim.
if you "rightclick", you can slowly bring back the settings to zero. And so on...
As said it's a nice playground. How useful it's another question!

Btw
" (M:Y) 50 - 50 / " brings the same result.
You only get a smaller control area for the mouse.
 
Top