Sign in to follow this  
Guest fbnweoghnwd

User-controlled switch in VC

Recommended Posts

Does anyone have some good, step-by-step instructions for creating a clickable switch in the VC? For starters, I'm just trying to create a switch that will turn on the nav lights (which already works fine in the 2D panel). I'm using 3DS Max, and the FSX exporting tools. I set the keyframes for the switch, attached the animation with the attachtool, and added the switch_nav_light tag in the Animation Manager. But in the sim, the switch won't respond to mouse-over. Did I miss a step?

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

I'm assuming that you used the Attachpoint Tool to set the "Mouse Rectangle" for the 3d switch lever in the model. Did you verify that the code was actually written to the Properties for that part?Select the part and right-click anywhere on screen, then choose Properties, and select the User Defined tab. You should see the code the Attachpoint Tool created there. If no code appears, repeat the process with the Attachpoint Tool.You added keys at 0 and 50, then animated the switch lever, right?Use the GraphEditor/Trackview to make sure that the Animation Manager added the code for your part.

Share this post


Link to post
Share on other sites

All seems to be in order - the keyframes are set, the MouseRect code shows up in the properties, and the animation shows up in the Note track in Track View. If you turn the nav light switch that's in the 2D panel on and off, the 3D one in the VC responds as well. But if you try to click the 3D switch, nothing happens - the cursor doesn't change and you can't move the switch.

Share this post


Link to post
Share on other sites

Here is an example that works in FS9 / GMAX:This is an example of a simple up/down swith that does nothing, but it is "clickable" in FS.To assign a working function to it, you'll have to change the callback code (see below).In this example it only changes the boolean value of the variable (L:VC Test Switch,bool). This callback code is the same as the click event in XML gauges, so any of the known events can be used.I added a tooltip, which can be cusomized too.step 1:Create a switch in the model (with GMAX), and name itVC_test_switchstep2:Animate that switch from frame 0 to 100 (up to down)step3:Add a new part to the MakeMDL.Parts.XMLYou'll find that file in the ...Gmaxgamepacksfs2004pluginsOpen it with an XML editor and add this:VC_test_switch(L:VC TEST SWITCH,bool) 100 * HandHERBERT'S SWITCH FOR NOTHING(L:VC TEST SWITCH,bool) ! (>L:VC TEST SWITCH,bool)step4: Save the file and export the model using the standard export function of GMAX.The essential things are:1. The part name of the poly (the switch or whatever) in GMAX must be the same than in the name in the MakeMDL.Parts.XML2. The animation parameter must fit to what the callback code does as well as to the animation frames.In this example the callback code toggles the variables value from 0 to 1, the animation uses 100 frames, so the callback code needs a mathematic term to convert 0 to 1 into 0 to 100 - which is the simple mathematic operation: * 100.Hope this helps!Herbert

Share this post


Link to post
Share on other sites

>All seems to be in order - the keyframes are set, the>MouseRect code shows up in the properties, and the animation>shows up in the Note track in Track View. If you turn the nav>light switch that's in the 2D panel on and off, the 3D one in>the VC responds as well. But if you try to click the 3D>switch, nothing happens - the cursor doesn't change and you>can't move the switch.There are two possibilities that come to mind...1) Select the switch lever part and apply Reset/Scale. I've found that this will "fix" any part that isn't "mousable" in FSX VC. Any part that's even had a whiff of Uniform Scale will NOT be "mousable" in the VC.2) Make sure that your eyepoint in the VC isn't "inside" any other part (such as a headrest), as this WILL block "mousability" for certain parts, including gauge click points.

Share this post


Link to post
Share on other sites

I've already tried re-setting the scale and transforms, and that didn't fix it. But the name of the switch object in Max doesn't jibe with the one in the Modeldef file - it uses my own naming convention. Could that be it? I'll try re-naming it when I get home tonight.

Share this post


Link to post
Share on other sites

Got it working!The naming convention didn't matter - it doesn't seem to make a difference what you call it. But I found some weird axis bug in the switch object which would take a month to explain, and when I fixed it, the switch worked. So I guess the moral of the story is if you try all the things mentioned in the posts above and it still doesn't work, the object might have the same bug mine had - so re-build it or clone a new one from a working one.Thanks for the help, guys.

Share this post


Link to post
Share on other sites

>Got it working!>>The naming convention didn't matter - it doesn't seem to make>a difference what you call it. But I found some weird axis bug>in the switch object which would take a month to explain, and>when I fixed it, the switch worked. So I guess the moral of>the story is if you try all the things mentioned in the posts>above and it still doesn't work, the object might have the>same bug mine had - so re-build it or clone a new one from a>working one.>>Thanks for the help, guys.The single largest stumbling block for most modelers is coming to grips with the fact that the part's name is - unlike previously - completely irrelevant. You could name your switch lever part "Fred" and it would still work just fine, provided you used the Animation Tool and Attachpoint Tool to associate the modeldef.xml code to the part properly... ;)Of course, we should STILL use meaningful names for our own sanity and comprehension... ;)You got bit by the "misaligned axis syndrome" then. That can usually be cured by selecting "Affect Pivot Only" and reseting the alignment to World. I've had that happen (more than I care to admit!)...

Share this post


Link to post
Share on other sites

Bill,you may be right - no I'm sure, you are right.But with my very little experiences in modelling I just showed a working way to produce such user defined animated parts using GMax together with (MS's) eport tool MakeMdl.exeb / MakeMDL.parts.xmlIn this case the names of the parts DO matter. Fred doesn't work...Best regards,Herbert

Share this post


Link to post
Share on other sites

>In this case the names of the parts DO matter. Fred doesn't>work...As far as I know, Makemdl.exe is strictly an FS9 export technology - so names will, in fact, matter. Bill is refering to the FSX export tools...where they've done away with this.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this