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

Controlling Animations with SimConnect

Messages
1,057
Country
ca-ontario
I'm fairly comfy now with SimConnect, and doing all kinds of funky stuff I only used to dream of before :D Pushing the envelope further and further, I'd like to know if there is a way to access animations in aircraft model and:

- trigger them
- be notified when they end

I am not interested in trigerring "stock" animations using the FSX's "stock" events (open door, retract gear, etc.) but instead using completely custom animations with custom, SimConnect-only variables.

I understand that the anims can be accessed through Mission Engine - but is the same connectivity available to us in SimConnect?

Thanks,
Misho
 
Interesting question, would also like to know more about this. Sorry no answer from me this time :D.
 
Hi Arno! Long time no see! Too bad AVSIM is not hosting another conference this year, eh? There was talk of Florida, I would have loved that!

Yeah - I'll poke further into this, and perhaps prod a few of my MS contacts. Apparently, every anim has its GUID (correct me if I'm wrong) so there could be a method to access that.

A simple module could then be developed to read in a script of animations and conditions for triggering... that would be cool!

Misho
 
Interesting question indeed. I've asked a similar one before.

So far I have not found a way to add a custom SimConnect variable to be used to trigger animations.

Today I did come across something I had not noticed before though. In the modeldef.xml file there is an animation defined for the baggageloaderarm. Not a default airplane animation, and in fact an animation on an AI Groundvehicle.

The interesting bit is in the Code section of the PartInfo for this animation:

(V:SimContain.BaggageLoaderArmAngle:1, degrees)

And then in the propcontain.xml file:

<PropertyDef
id = "{0E4FB8AE-E59B-43ed-8E7F-B0132FE71E95}"
name = "BaggageLoaderArmAngle"
type = "FLOAT"
default = "0.0">
</PropertyDef>

So, it seems the baggageloader arm animation is in the mission realm somewhere.
 
Hmmm promising! If I am reading this right, this suggests that a part of the model can be told to rotate x degrees... Right?

Misho
 
Yes, but I fear that it is being controlled using some internal FSX parameter.

In this case the angle will depend on the elevation of the baggage door, but since a separate baggage loader can be active for each plane, there must be some way to differentiate between all the loaders.

Still, I don't see any way to add custom parameters like this.

Daniel
 
Okay, there is clearly a way to do this, but I have had no time to look into it closely (yet ;) ):

From Panels/Gauges SDK:

"Custom Events
Third parties can use custom events with ID numbers in the following range to communicate between 3D virtual cockpits and 2D C++ gauges. See the example code for the function register_key_event_handler."

then...for register_key_event_handler code:

"This example shows how to receive custom numeric events from part animations (refer to the Creating a New Animation section of the Using Modeling Tools document)."

Now, I know that I can trigger model anims (both VC and External) through the VC custom animations (pretty easy, actually). So, it looks like it is possible to trigger custom anims from the Panel API.

Now - I'm pretty sure that:

A - SimConnect can share Gauges API custom variable... right? So, the custom anims should be able to be activated through SimConnect.

B - Even though the above specifies how to receive , I'm pretty sure you can send as well...

I came across this while I was developing some C++ gauges. I'll look at it more closely when I get a bit more free time. If anyone finds out anything more on this, please share :D

Misho
 
Last edited:
Hi Misho,

I just came across the same :)

I noticed this line in the update text for SDK SP1a:

The ability to export custom event IDs in a model, so that the IDs can be referenced in the panel system or in a SimConnect client, has been added.

It was hard to find anything related to this, but my first clue was in the New Animations document. If you look at the EventId tag description inside the MouseRect tag:

Alternatively a custom numeric event can be defined, to be picked up by a gauge handler written in C++. See the example code for the function register_key_event_handler in the Programming C++ Gauges document.

<EventID>THIRD_PARTY_EVENT_ID_MIN + 0 </EventID>
<EventID>THIRD_PARTY_EVENT_ID_MIN + 1 </EventID>

From the C++ document:

#define THIRD_PARTY_EVENT_ID_MIN 0x00011000
#define THIRD_PARTY_EVENT_ID_MAX 0x0001FFFF

And then in the SimConnect_MapClientEventToSimEvent method in the SimConnect document:

Alternatively enter a decimal number in the format "#nnnn" or a hex number in the format "#0xnnnn", where these numbers are in the range THIRD_PARTY_EVENT_ID_MIN and THIRD_PARTY_EVENT_ID_MAX, in order to receive events from third-party add-ons to Flight Simulator X.



Still, if I look at the example and the fact that for the model the EventId is defined inside the MouseRect, I get the impression that this will only work as a trigger. It seems you can receive the fact that a user clicked the tagged part, or by using SimConnect_TransmitClientEvent you can simulate a user clicking the tagged part.

Daniel
 
Hi Misho,

I just came across the same :)

I noticed this line in the update text for SDK SP1a:



It was hard to find anything related to this, but my first clue was in the New Animations document. If you look at the EventId tag description inside the MouseRect tag:



From the C++ document:



And then in the SimConnect_MapClientEventToSimEvent method in the SimConnect document:





Still, if I look at the example and the fact that for the model the EventId is defined inside the MouseRect, I get the impression that this will only work as a trigger. It seems you can receive the fact that a user clicked the tagged part, or by using SimConnect_TransmitClientEvent you can simulate a user clicking the tagged part.

Daniel

Yup - I haven't had the time to go further into this, but I am at the moment communicating between custom anims and C gauges without any problem, so I'm pretty sure this can be extended to SimConnect. My main concern was to trigger the anims, which it seems can be done, from what you've quoted. What we're talkingabout here is the "pre-recorded", keyframed animation. Some folks have been hoping for a bit more advanced control of specific parts, as in adjusting the rotation and position.

Another thing I want to be able to do is to trigger the kayframed anim and be notified of completion. Is it safe to assume that anims are still running on the internal 18 HZ clock? In that case, it would be trivial to figure out when the anim is done, by counting how many frames have elapsed on the 18 HZ clock and knowing how many frames there are in total...

Not sure if anyone has tried ths out, but my guess is that the custom anims will NOT work with the scenery objects - correct? I don't think the scenery objects are compiled with the modeldef.xml files. That's bad news, as I would love to develop apps that let me control scenery objects... (for example, opening the hangar doors when in proximity).
 
The definitions from the modeldef.xml file are used, but I don't think the 'mouserect' section will have any effect there. But well worth trying though.

As for the 18Hz clock, I don't think it is used anymore, look at the Lag tag in the mouserect tag. It more or less allows you to set the framerate for the animation.

Daniel
 
I've been distracted for a while, but let's get back to the topic :)

Yes, Lag Tag seems to scale the anim speed... fine... but what is the base anim speed? I.E. What is the rate each frame of animation gets advanced? At every screen refresh? That doesn't make sense, because then for example, the retracting gear would retract very fast on fast machine and slow on slow framerates. There must be an underlying clock counter that governs the animation rate and keeps it constant anim speed at all frame rates. The Lag Tag only scales that speed up or down. Guess I can do some timing experiments and see if its still at tick18, or something fancier.
 
Tick18 has been replaced by any of eight Ambient or eight NonRandomAmbient tags...

They coincidentally have an 18Hz cycle... :D
 
Back
Top