• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

P3D v4 Click Area's on a rocker switch (3d Switch in VC)

Messages
10,158
Country
us-arizona
Hey all,

Can one code a 3d rocker switch to have two input area's on it? For instance, click the top, and it moves upwards, then back. Click the bottom side, and it moves downwards, then back to neutral.
I know 2d gauges were able to be done this way with their mouse click zones. But this is for XML part animation, 3d mesh.

Many thanks for any input.

Bill
 
Try two transporent poylgons with a mouse rectangle each that are children to the switch.
 
Have you tried using the Slice tool?
  1. Select the switch
  2. Go to the Border sub-level
  3. Select all borders
  4. Select Slice tool
  5. Use Angle Snap if needed to rotate tool's plane 90º
  6. Click on Slice
  7. Go to Polygon sub-level
  8. Select half of the polys and click on Detach
  9. Rename as desired
Ff8tM.png
Ff8yl.png


Now you can select the two face objects and apply a MoustRect as you wish.

These four buttons started out as one 'box' each. I used the Slice plane to cut the faces into two separate objects and Linked them to the "frames". I then cloned each of the four faces so I could assign an Unlighted and Lighted Material to the OFF and ON faces.
Ff8fB.png
 
Another alternative would be to script XML such that L-click does action A and R-click does action B.
 
Thanks guys.
My issue is the coding of the two different movements. L-Click for instance must move the switch upwards. R-Click would move the switch downwards. With each movement, it would return back to 50% point.

I think I just answered my question. When you let off the mouse button, it would travel to 50% KF point. arrgh... Talking about things often finds the answers.

A thousand thanks.
 
BINGO!

Here is a quick example of a L-Click, L-Release and R-Click, R-Release:
XML:
  <PartInfo>
    <Name>Oxy_Test_Copilot_Mask</Name>
    <MouseRect>
      <Cursor>HAND</Cursor>
      <MouseFlags>LeftSingle+LeftRelease+RightSingle+RightRelease</MouseFlags>
      <CallbackCode>
        (M:Event) 'LeftSingle' scmp 0 == if{ -1 (>L:Oxy_Test_Copilot_Mask,bool) }
        (M:Event) 'LeftRelease' scmp 0 == if{ 0 (>L:Oxy_Test_Copilot_Mask,bool) }
        (M:Event) 'RightSingle' scmp 0 == if{ 1 (>L:Oxy_Test_Copilot_Mask,bool) }
        (M:Event) 'RightRelease' scmp 0 == if{ 0 (>L:Oxy_Test_Copilot_Mask,bool) }
      </CallbackCode>
    </MouseRect>
  </PartInfo>
 
Back
Top