• 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.

Mouse Rectangle modeldef.xml entry for animated hangar

Messages
67
Country
unitedkingdom
Hello!

I'm working on an animated hangar that is controlled by a mouse rectangle. I already modeled and animated the hangar. I also tested the animation using SODE with a Trigger Radius which works just fine. After trying multiple mouse rectangles applied with MCX, the Clickbox appears in the sim in the used ModelPart. So far so good. Here's the problem I have: None of the Part info entries in the modeldef.xml seemed to work, because none of the listed CallBacks can trigger or start the animation? If that is correct I'd like to ask what the CallBack entry has to look like for this example ( animated hangar ).

Thanks,

Norvin.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,858
Country
netherlands
How did you place your hangar in the scenery? Because I think mouse rectangles are intended for the virtual cockpit mainly and I'm not sure all work in scenery.
 
Messages
1,047
Country
australia
Unless someone has more information then I think you are trying to do something that is impossible. I believe you will only get mouse rectangles to work in the virtual cockpit view (they do not work in the external view) of the user sim object (ie the user's aircraft).
 
Messages
67
Country
unitedkingdom
How did you place your hangar in the scenery? Because I think mouse rectangles are intended for the virtual cockpit mainly and I'm not sure all work in scenery.
Unless someone has more information then I think you are trying to do something that is impossible. I believe you will only get mouse rectangles to work in the virtual cockpit view (they do not work in the external view) of the user sim object (ie the user's aircraft).

The object is placed as an .mdl file using SODE without any visibility conditions or anything. I use SODE for this because you don't have restart the simulator every time. If I remember correctly the mouse rectangle is visible in the VC, but only in a specific angle, though in the external view it's working perfectly. But, is it possible to control an animation with a mouse rectangle that is not in the VC ( like controlling landing lights, or any other buttons in the cockpit with animation )?

Norvin.
 
D

Deleted member 1281

Guest
Yes, in P3D (maybe only the more recent versions) you can use mouse control in a mdl's external view, such as open the exits or start an engine. Like so:

Code:
<PartInfo>
<Name>bombdoors</Name>
<AnimLength>100</AnimLength>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>Open/close bomb bay doors</TooltipText>
<CallbackCode>
  (>K:TOGGLE_AIRCRAFT_EXIT) (>K:SELECT_2) (>K:ENGINE)
</CallbackCode>
</MouseRect>
</PartInfo>
 
Messages
67
Country
unitedkingdom
Thanks for the information! That is a proof for my rectangle that is visible... So I still don't know what to put in the CallbackCode.. Is it keyframes of the animation or something else or is it not possible to control this animation without using aircraft functions ( landing light, aircraft exit, bomber door )?

Thanks
 

tgibson

Resource contributor
Messages
11,324
Country
us-california
Hi,

My guess would be:

1. Write a section in the ModelDef.xml file like the bombdoors section above. Use a Name like hangardoors. For the callback code you will need to set an L: variable (custom variable) to flip back and forth between 0 and the number of keyframes used for the door.

2. Add an Animation section to this ModelDef.xml section and make the animation equal to the value of the custom L: variable.

3. In MCX in the Hierarchy Editor, assign the hangardoors tag to the Animation section of your doors.

4. Also assign the hangardoors tag to the Mouse Rectangle section.

5. Export as usual.

The part info could look something like this, but this has not been tested. The Lag value can be changed to alter the speed of the movements (the 100 here does NOT relate to the number of keyframes). This is set up for 100 keyframes, but can be changed (Animation name, AnimLength and CallbackCode sections).

XML:
<Animation name="hangardoors" guid="3020b8b6-f1f3-48c8-b464-5ff89ef84ffd" length="100" type="Sim" typeParam2="hangardoors" typeParam="AutoPlay" />

<PartInfo>
    <Name>hangardoors</Name>
    <AnimLength>100</AnimLength>
    <Animation>
       <Parameter>
       <Code> (L:Hangardoors, enum) </Code>
        <Lag>100</Lag>
       </Parameter>
    </Animation>
<MouseRect>
       <Cursor>Hand</Cursor>
       <TooltipText>Hangar Doors</TooltipText>
        <MouseFlags>LeftSingle</MouseFlags>
        <CallbackCode>
            (M:Event) 'LeftSingle' scmp 0 == if{ (L:Hangardoors, enum) 0 == if{ 100 (>L:Hangardoors enum)  } els{ 0 (>L:Hangardoors, enum) } }
          </CallbackCode>
    </MouseRect>
</PartInfo>

Hope this helps,
 
Last edited:
Messages
67
Country
unitedkingdom
Hi,

My guess would be:

1. Write a section in the ModelDef.xml file like the bombdoors section above. Use a Name like hangardoors. For the callback code you will need to set an L: variable (custom variable) to flip back and forth between 0 and the number of keyframes used for the door.

2. Add an Animation section to this ModelDef.xml section and make the animation equal to the value of the custom L: variable.

3. In MCX in the Hierarchy Editor, assign the hangardoors tag to the Animation section of your doors.

4. Also assign the hangardoors tag to the Mouse Rectangle section.

5. Export as usual.

The part info could look something like this, but this has not been tested. The Lag value can be changed to alter the speed of the movements (the 100 here does NOT relate to the number of keyframes). This is set up for 100 keyframes, but can be changed (AnimLength and CallbackCode sections).

XML:
<Animation name="hangardoors" guid="3020b8b6-f1f3-48c8-b464-5ff89ef84ffd" length="100" type="Sim" typeParam2="hangardoors" typeParam="AutoPlay" />

<PartInfo>
    <Name>hangardoors</Name>
    <AnimLength>100</AnimLength>
    <Animation>
       <Parameter>
       <Code> (L:Hangardoors, enum) </Code>
        <Lag>100</Lag>
       </Parameter>
    </Animation>
<MouseRect>
       <Cursor>Hand</Cursor>
       <TooltipText>Hangar Doors</TooltipText>
        <MouseFlags>LeftSingle</MouseFlags>
        <CallbackCode>
            (M:Event) 'LeftSingle' scmp 0 == if{ (L:Hangardoors, enum) 0 == if{ 100 (>L:Hangardoors enum)  } els{ 0 (>L:Hangardoors, enum) } }
          </CallbackCode>
    </MouseRect>
</PartInfo>

Hope this helps,

Hello! Thanks for your help so far!
I have tried it but it didn't work for me. I have added the hangar files with everything you need! Just to let you know it has got PBR Materials but not on the Animated parts and Dynamic lighting effects. if you don't want them on your test you can delete them as needed. Thanks for your help again!

Norvin
 

Attachments

  • Mouse Rectangle Hangar.zip
    1,010.6 KB · Views: 267
Last edited:

tgibson

Resource contributor
Messages
11,324
Country
us-california
I tried it and it doesn't work for me either. I don't know any more, sorry...
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
AFAIK, 3d mouse rectangles will only work on user flyable objects. ;)
 
Top