I’m trying to learn Blender and MSFS aircraft development in small, (relatively) simple steps. I was able to import the Simple Aircraft sample into Blender 3.6 and then export it so that it loads properly into MSFS with correct texturing and animations working as expected. Now I’m trying to do a simple cockpit animation.
I’ve created a basic two position switch and animated it using key frames in Blender. Key Frame 0 is the off position and Key Frame 1 rotates 25 degrees to on. The switch shows up in the aircraft and I can make the animation play if I use the slider under the animations tab in the Behaviors Editor, but clicking on the switch does nothing. Using Debug Interaction confirms that it isn’t selectable, yet Behavior editor does show a mouserect of sorts (though it doesn’t seem to have code for click events and the other events don’t seem to work).
I’m using the ASOBO_GT_Switch_2States template and I’m expecting this to be sufficient to wire things up:
It isn’t clear to me whether I need a PANEL_COLLISION mesh at this point, but I’ve tried to make one anyway. However, when I turn on Debug Collisions and check mesh, it shows up as a floating black thing that is well in front of my panel. No doubt there is some Blender trick I’m missing. For the collision mesh material, I did choose Invisible and I did check the Collision Material box.
Can anybody tell me what I’m missing (or doing incorrectly) to enable mouse interaction with my switch? Alternatively, does anyone have any tips for debugging the problem? Thanks!
Thanks @DA40CGDFQ. Unfortunately, that didn’t make a difference. The animation works if I use the slider through behavior editor, but the switch isn’t selectable and I can’t interact with it using the mouse.
Am I correct in thinking that using the ASOBO_GT_Switch_2States template is all that should be required to make the switch work in the sim? I did change the name of the animation to match the mesh node name, but that didn’t help. I also tried checking the Collision Material box for the switch material, but that didn’t work either.
I should also add that I’m not seeing anything in the dev console or the behaviors log that is suggestive of a problem. The package builds without error and the few warnings seem unrelated.
Are you using blender? (edit yes you are) If so the object name not the mesh name. Second the node id match the object name. The animation names must match your xml anim_name
Still not working. I did try pushing my animations onto the NLA stack like you have, but still no joy. The only real change was if I use the ASOBO_Lighting_Switch_Light_Navigation_Template template, the switch defaults to ON. Here is what my outliner looks like:
Here is how I’m modelling the switch. Right now I’m just trying to keep things simple with no parenting or empty objects; just a switch shaft and collar.
Thanks again for your help. Given my lack of Blender experience, I feel like I must be missing something obvious (or doing something stupid), but I can’t figure out what it is. The only other thing I can think of is that I’m working with a single model xml file. I haven’t yet split out the interior into a separate model because I wanted to verify that my switch worked first.
Ok looks like you are trying to learn aircraft and Blender stuff all in one big bite. I suggest you find some youtube tutorials on how this all fits together, Blender objects and meshes and animations relate to sim xml templates and xml programming and variables.
This is very complex and one tiny mistake - nothing works as expected.
There are lots of tutorials
Jonx
EZRyder
Rotornut44
Well, I was trying to learn it in small pieces , hence wiring up a single switch. I see now you have put out some youtube tutorials. I’ll give those a watch. Thanks again for the help.
Got it working! Thanks to @Jonx for the great tutorial series. Honestly, I’m not sure what I was doing wrong. The only major change I made was to separate the model into exterior and interior, but I suspect that what probably fixed this was that I went back to an earlier .blend file when I did so. I’m thinking that maybe I just got the later file into a bad state.
For anyone following this thread, per the documentation: only two key frames are necessary for two position switches in blender. The switch should be in the off position for the first key frame and it should be in the on position for the second key frame. That is how my test switch is animated and I works properly with two key frames.
Also, pushing animations onto the NLA stack is probably the safest way to ensure animations get exported. I couldn’t find any official documentation discussing this, but the SimpleAircraft sample uses NLA, so that is a pretty strong indication that doing so is the correct approach.