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

Need Help with Animations

Messages
10
Country
us-washington
Hi,

I'm trying to create a custom animation in FSX and I need help!! I'm trying to get missles to fire from an aircraft. I've been able to animate everything I need in the FSX gmax SDK, but now I need to find out how to trigger the animation in FSX with a button in the VC.

Also, I tried to put a knob into the VC as a rudder trim, and although I can see the percentage change in the tootip text in FSX, the knob doesn't move in FSX. It moves in gmax though.

Can anyone tell me what am I doing wrong??

fsnewbie
 
Hey FSNewbie,

Are you saying you havent written code before for a FSX plane? or that you cannot seem to get the code working for the plane...?


Basically you want to create a 'custom' L var and then set its animation speed. You may need two, one being the actual part animation code, and then a switch that 'starts' the code.


If you are a newbie to writing code, basically you have a main command string buried in a block of code. This command would be something like;

L:FIRE NUBE MISSLE

Which would then be contained in a sub-string;

(L:FIRE NUBE MISSLE, bool) (bool means something similar to 'run' ).

Here is a quick animation block that will run both a switch and a part. Mind you the switch will run at the same speed as the part will, so if you want to make the switch animate, and at a different speed, you would then create (copy/paste) a second block of code, and change key points in the block, making it different from the first, but keep the primary code string; (L:FIRE NUBE MISSLE, bool) which will cause the first one to work also.

Here is the code for testing it with.

Code:
    <PartInfo> 
    <Name>newbie_fire_missle</Name>
	  <AnimLength>100</AnimLength>
	  <Animation>
		  <Parameter>
			 <Code>(L:FIRE NUBE MISSLE, bool) 100 *</Code>
			<Lag>10</Lag>
		  </Parameter>
	   </Animation> 
    <MouseRect>
	  <Cursor>Hand</Cursor>
	<TooltipText>Fire Missle One</TooltipText>
	  <CallbackCode>
    (L:FIRE NUBE MISSLE,bool) ! (>L:FIRE NUBE MISSLE,bool)  
	  </CallbackCode>
    </MouseRect>
</PartInfo>

This is set to a very slow speed, so you may wish to increase the Lag time. note that ToolTip is what the mouseover will say. Note two, the Callback code is the 'run, stop run' code command.


There are tons of different ways to write code. This is only an example 'if' you are a newbie to code writing. This will get you going and can experiment with how its done. You may wish to do something more exotic which would have timers and things, a auto-reset calculator based on a set time element where the missle comes back and reattaches itself, etc, etc. Thats up to you and I have no idea how to write exotic code. (I hire people to do that for me now).

In case you do not know where the code is put in at, you would enter it into the 'elaborate' and massive 'modeldef.xml' code sheet, which you open with Windows Notepad and edit as you need. This is located in your FSX SDK/Evironment Kit/Model SDK/Bin folder. Make a backup copy before carrying out work on it so if you mess up your main code sheet, you can go to your backup and start over again. (I date my backups, and have perhaps 20 of them so far just in case). Note that you must also create a GUID string at the top of the 'modeldef.xml' code sheet. Pick up the GUID generator and make a new GUID for your code and copy/paste another string with a similar animation and make that your new GUID string. Here is an example;

<Animation name="lhc_park_aircraft_mode_switch" guid="456BD238-20FD-48ff-9CD7-31913FF44AB2" length="100" type="Sim" typeParam2="lhc_park_aircraft_mode_switch" typeParam="AutoPlay" />

You would switch out the 'names' sections to the name on your new missle code, the actual part code itself.

<--- insert belly ache here Why we need a sophisticated serial number and renaming of names several times in different locations, I'll never know.... why oh why... (smacks head on desk)

I hope that helps and puts some light on the subject for you.



Bill
 
Last edited:
Hi Bill,

I appreciate your help!!! Yes, I am a newbie to writing code. I have a lot to learn, but if I could get this project going, I will have an idea of how things work!!

I will report back about my progress!!! Going to try your code tonight!!

Thanks again!!!!


fsnewbie
 
Hey Bill,

Success!!!! Got the animation working!!! Now I need to read up on how to trigger it also from a keystroke.

Question, is there a way to have the missle disappear when it has reached the end of it's run, and is there a way to get it to reset without doing a "reverse" animation back to the pylon?

Thanks for the help Bill!!!

fsnewbie
 
Glad its working!

Man, visibilities are difficult. I have run aground on the same problem with my engine cowlings. I want the engine and nose bays to hide when the cowlings are in place, but havent figured out a way to make that work properly.

On keystrokes, thats a difficult call. There are ways, but they have a specialised route. I think Fr. Bill can tell you more on that. You may need a C++ gauge or something to get that working, or use a stock keyboard animation call, such as water rudder, etc. (Check the controls menu in FSX for listings of keyboard animation keystrokes or built in, hard wired calls/links).

(I think thats how it would go, not sure as I dont go that route anymore).

If you find a way to do your visibility thing, please document it.

Oh, and if you are talking about things like bombs or missles leaving the craft and then disappearing, there is some awesome work done by Paco Sanchez on his B-17 bombs in the www.freeflightdesign.com center. I have totally forgotten where the post is on them, but his physics calculations of accellerations on bombs with the disappearing act is brilliant.


Bill
 
Ok, I will ask around further on those points. And yes, I will report on progress!!

Got one more question for you {I promise this will be the last!! lol}

As you know I got the missle animation to work, but as per the SDK, I created an attach point effect, then added a new event for the missle and added the parameters needed {through the animation manager} to have the effect trigger when the animation does. Well, the effect is present non-stop on the missle. I've tried going over it several times, but with absolutely no luck at all. Does that feature even work in the animation tool? Have you had any luck getting to work and if so how? lol


Thanks!!

AJ
 
Last edited:
As you know I got the missle animation to work, but as per the SDK, I created an attach point effect, then added a new event for the missle and added the parameters needed {through the animation manager} to have the effect trigger when the animation does. Well, the effect is present non-stop on the missle. I've tried going over it several times, but with absolutely no luck at all. Does that feature even work in the animation tool? Have you had any luck getting to work and if so how? lol


Thanks!!

AJ


Hey AJ,

That is a difficult one to answer as I dont know what all is going on. First, I would check that you have the 'attach' effects in the Object Properties/GUID section, that they are on it. (One is, evidently).

Second, you should probably have a secondary dummy part, (small cube structure) with the secondary effect.

Third, you need to tell it when to work. One way is to attach a Visibility, and have that coded (in the master Parts XML sheet) and when the key elements for it to show up 'occur' then its visible and you can see the effect going on. This is how the Landing Lights work. If you have the Viz setup 'with' it (on the same polygon), then it works fine when you turn on the landing lights, thus the polygon with effect has a viz attachpoint, and a effect attachpoint.


If you look over some existing 'visibility' codes (use the list to find them in the Parts XML sheet), then you can get an idea on how to write your own Viz code.


Also, you might seperate your new codes for your plane into one group cluster (well, two, one at the top in the GUID strings, and one at the bottom section, top of the actual 'parts' code blocks) so that your codes are easy to find and thus easy to tune and modify. (Great to be organized).



Bill
 
Hey bill,

Ok! I will run through your suggestions tonight and report back to you tomorrow.

Thanks for your time on this!!!


AJ
 
Hey Bill,

No luck!!:mad: I went through and checked on the things you suggested, but I didn't get any different results. The effect still runs continuously!!

Here's what the SDK says:

" Events allow a user to add special effect triggers into an animation (for examples of these, open up the oil rig or the orca whale models). Frame is the frame at which the effect is triggered, Name/Command should be set to VFX0 (the internal code for triggering a visual effect), and Parameter is effectname,attachpoint name (for example, fx_whalebreach,attachpt_whalebreach_1). Every time the animation gets triggered, the associated effects play. You need to have an animation selected in order to add events to it."

One thing that I noticed is that it mentions the oil rig and orca whale models. Well, I've looked in my FSX gamepack/scenes and I only have an oil rig model and I didn't see any parts on the model that had an effect attached to an animation. I apparently am missing a big piece of the puzzle here.

Could you do me a favor Bill IF you {or anybody else following this thread!} have the time? Could you create something and attempt to attach an effect to an animation the way the SDK states and tell me if it works for you? I'm telling you, I've tried everything I could think of, and I get nothing!!!

I'll check back sometime tomorrow.

BTW: I also looked into the Visibilty issue, and it seems that that only works with default Sim variables. I attempted to create a new Viz entry using an L var and it totaly disabled the Visablity section of the animation tool. I then changed the code in the modeldef.xml to make it a Sim Var and nothing happened within the model.

Thanks Bill,

AJ
 
Last edited:
They do NOT work. I had a 'smoke effect' Attached to my GPU cart and had it tied to the GPU's vis variable.

The darn smoke would always be appearing, even when the entire GPU cart was hidden... :(

After trying for days to get it to work, I finally removed it entirely and gave up.

Apparently, this is as 'broken' as the 'conditional animations' in FSX... :mad:
 
Thanks Bill L.

That puts a big damper on what I'm currently working on!!! I wonder how delta sim got the effects to work on the HMS King George then? I doubt if they would share that info!!! lol

So I guess the only thing left is to find a way to create or use an existing vis that will get the missle to disappear.

Thanks guys!!

AJ
 
That quote from the SDK that refers to the OilRig and the Orca is in reference to using Mission script to control the visibility of Attached effects, which is an entirely different scheme than what is used in a user controlled model.

Although I haven't studied it that closely, I believe that the Mission script is what adds the explosions, fire, smoke, etc. to the model in the scene via 'empty Attachpoints' that're are in the model.

Thus, the effects only appear/disappear based on the Mission script engine's control...
 
Hey Bill L.

Would it be possible to drop me your email via pm? I wanted to ask you something in private. I just tried to send you an email through the site here, but I got an error message.

Thanks,

AJ
 
Ok, if there is anybody out there listening, I 've got two more request to attempt to get this thing going.

1. Can anyone help construct an expression {that will work!! smile} that will make the entire variable (L:xyz, bool) turn off, (>L:xyz, bool) } at an adjustable time length? For instance in x amount of seconds or x amount of animation frames.

2. Also, could anyone point me in the right direction on how to tie a keyboard command in as well as a mouse rect to get the animation to stop.

I appreciate all the help that has been given, you guys have been great!!!!

Looking forward to getting this info, it may the last piece I need!!!

Thanks,

Aj
 
Hi,

from the scratch (meaning: it might not work as it is) here is the code for a spring loaded button with a 10 seconds timer.
Code:
  <PartInfo>
    <Name>spring_loaded_button</Name>
    <AnimLength>50</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (E:ABSOLUTE TIME,seconds) (L:TIMER,seconds) &gt;
          if{
            0 (&gt;L:SPRING BUTTON,bool)
          }

          (L:SPRING BUTTON,bool) 50 *
        </Code>
        <Lag>100</Lag>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <TooltipText>Spring loaded button with no use</TooltipText>
      <MouseFlags>LeftSingle</MouseFlags>
      <CallbackCode>
        1 (&gt;L:SPRING BUTTON,bool)
        (E:ABSOLUTE TIME,seconds) 10 + (&gt;L:TIMER,seconds)
      </CallbackCode>
    </MouseRect>
  </PartInfo>
When you click on it it will set the timer with:
Code:
(E:ABSOLUTE TIME,seconds) 10 + (&gt;L:TIMER,seconds)
The end of the 10 seconds cycle is evaluated in the <Parameter> section where the (L:SPRING BUTTON,bool) varaible is set to 0 if the time is up.

Hope that helps.
Cheers,
Vitus
 
Hey Vitus,

Cool!! I will play with it and report back what I come up with.

You got anything on tying mouse and keyboard fuctions in together?\


Thanks again,

AJ
 
not really. I try to use the standard FSX variables to be able to use the keyboard commands assigned to it. But this sometimes can be a real struggle.
 
Gotcha!!! Well, I quess I have to put this one on the shelf till I can find a work around!! Thanks guys for your help, you've been great!!!


AJ
 
Back
Top