Beginner - How to create default toggle animations

For topics related to the creation of simulation objects (SimObjects). This includes development of aircraft, ground, and maritime vehicles.
iko
Posts: 3
Joined: Tue Jun 23, 2020 5:31 pm

Beginner - How to create default toggle animations

Postby iko » Tue Jun 23, 2020 5:41 pm

Hi,

I'm new to the entire Prepar3D SIM and especially the SDK.
I'm creating animations for a new aircraft and I've got the hang of how to use the default settings but not how to create my own "PartInfo".

I have an active thread over at FSDeveloper(https://www.fsdeveloper.com/forum/threa ... 3d.447938/) but I'm not getting the answers to get me further so I'm asking here as well.

My issue:
I can't see my custom animation move within P3D. If I tag the animation as something else (default like doors, Shift+E) it works.

I've tried to use the default modeldef.xml and the wing fold toggle (T) but it won't work either.

I've tried to create my own name and GUID but still use the WING FOLD variable and it still won't work. What am I doing wrong and is there a simple "code" I can use instead to just toggle an animation?

Code: Select all

<Animation name="thrust_reversor" guid="99510169-9693-4e44-8bd5-8e739bef0d07" length="100" type="Sim" typeParam2="thrust_reversor" typeParam="AutoPlay" />

Code: Select all

<PartInfo> <Name>thrust_reversor</Name> <AnimLength>100</AnimLength> <Animation> <Parameter> <Sim> <Variable>WING FOLD:0</Variable> <Units>percent</Units> </Sim> </Parameter> </Animation> <MouseRect> <Cursor>Hand</Cursor> <EventID>TOGGLE_WING_FOLD</EventID> </MouseRect> </PartInfo>
Thanks!

Clifton Crane
Lockheed Martin
Posts: 1043
Joined: Tue Sep 25, 2012 2:34 pm

Re: Beginner - How to create default toggle animations

Postby Clifton Crane » Tue Jun 23, 2020 6:59 pm

Hi iko,

"WING FOLD" is not a valid simulation variable. You may want to try the following in your <Variable> tag:

FOLDING WING LEFT PERCENT:1
FOLDING WING RIGHT PERCENT:1

Also, the aircraft that you are testing with will likely need to have folding wings configured in the aircraft.cfg in order to trigger the animation.

Hope this helps!

Regards,
Clifton
Clifton Crane
Prepar3D® Software Engineer Sr.

iko
Posts: 3
Joined: Tue Jun 23, 2020 5:31 pm

Re: Beginner - How to create default toggle animations

Postby iko » Tue Jun 23, 2020 8:00 pm

Hi iko,

"WING FOLD" is not a valid simulation variable. You may want to try the following in your <Variable> tag:

FOLDING WING LEFT PERCENT:1
FOLDING WING RIGHT PERCENT:1

Also, the aircraft that you are testing with will likely need to have folding wings configured in the aircraft.cfg in order to trigger the animation.

Hope this helps!

Regards,
Clifton
Thank you!

Like this?

Code: Select all

<PartInfo> <Name>thrust_reversor</Name> <AnimLength>100</AnimLength> <Animation> <Parameter> <Sim> <Variable>FOLDING WING LEFT PERCENT:1</Variable> </Sim> </Parameter> </Animation> <MouseRect> <Cursor>Hand</Cursor> <EventID>TOGGLE_WING_FOLD</EventID> </MouseRect> </PartInfo>

It still didn't work so I might need to add it in the "Aircraft.cfg". I didn't see anything about wing fold within the CFG.

Clifton Crane
Lockheed Martin
Posts: 1043
Joined: Tue Sep 25, 2012 2:34 pm

Re: Beginner - How to create default toggle animations

Postby Clifton Crane » Tue Jun 23, 2020 8:09 pm

Hi iko,

You'll want to add the <Units>percent</Units> property back. This will return the wing fold in the range 0-100, which will match your animation key frames.

By default, that simulation variable would return "percent over 100", which would return the value in the range 0.0 to 1.0, which wouldn't animate correctly.

Regards,
Clifton
Clifton Crane
Prepar3D® Software Engineer Sr.

iko
Posts: 3
Joined: Tue Jun 23, 2020 5:31 pm

Re: Beginner - How to create default toggle animations

Postby iko » Thu Jun 25, 2020 5:32 pm

Hi Clifton,

Thank you!

I can get it to work if I use the "wing_fold_l_pct" animation name, but can I change the name?

If I keep everything and only changes the name it wont work anymore. (I've changed it in both <Animation and <PartInfo). I've also tested to use the same GUID but with new name.

I would like at least three or four unique animations to be able to activate.

Clifton Crane
Lockheed Martin
Posts: 1043
Joined: Tue Sep 25, 2012 2:34 pm

Re: Beginner - How to create default toggle animations

Postby Clifton Crane » Mon Jun 29, 2020 12:56 pm

Hi iko,

If you wanted to create a new animation I would first add a new <Animation /> element with unique "name" and "GUID". You will also want to make sure that "typeparam2" matches the "name" attribute. Then you would also create new <PartInfo> section with a name that matches the new <Animation /> element (you could base this on an existing animation and update as needed). After you have added the animation to the modeldef.xml, you will also need to rebind that animation to the 3D model part in 3dsMax.

Note that the variable used in the PartInfo section is what will drive the animation. Simply creating new animations based on the same <Variable> will not create unique animations as they will all be driven by the same variable.

I noticed in your post your animation name is "thrust_reversor". The default modeldef.xml contains animation definitions for up to 4 engines. See the "thrust_rev" animation.

Hope this helps!

Regards,
Clifton
Clifton Crane
Prepar3D® Software Engineer Sr.


Return to “Simulation Object Development Questions”

Who is online

Users browsing this forum: No registered users and 16 guests