Jump to content

ModuleAnimationGroup - how to use.


Recommended Posts

It is a long waited complex animation module. But there is no any info for us, modders.

MODULE

{

name = ModuleAnimationGroup

deployAnimationName = Your_deploy/retract_animation (as it seems)

activeAnimationName = Looping_animation_for_active_state (as it seems)

deployActionName = Activate

retractActionName = Deactivate

moduleType = Scanner/Drill/... What else?

}


Actually found out.

- moduleType is just a string to be displayed in buttons: "{deployActionName} {moduleType}" and "{retractActionName} {moduleType}"

- you can skip deployActionName and retractActionName, they default to "Deploy" and "Retract".

- activeAnimationName DO start and stop looping animation, which is great. It actually follows the state of ModuleResourceHarvester and ModuleResourceScanner.

- you can skip deployAnimationName to only use looping animation. However not sure if loop can be started/stopped manually.

When combining both looping and non-looping animation in editor - ensure that during the wanna-be-looping part of animation everything else is stuck in deployed position. Then just divide your animation in two clips in Unity.

If you work in Blender and your loop looks weird - go to "File->User Preferences->Editing->New F-curve defaults" and set Interpolation to Linear. Then delete all loop keyframes and make new ones.

Edited by Dr. Jet
Found out how it works.
Link to comment
Share on other sites

There is also the very cool IAnimatedModule associated interface. When you deploy something with ModuleAnimationGroup it searches for all other modules on the same part the implement that interface and activates them (sets the base PartModule's isEnabled to true, which activates all of the OnUpdate, OnFixedUpdate code).

You can use this to allow the animation group to trigger functions in other modules. It's a very simple way of tying together multiple modules instead of trying to group clump everything together.

Link to comment
Share on other sites

It's not something you would use in a config file, it's something for new part modules to use.

Here is a very simple example of what I'm using in SCANsat to prevent the use of a scanner until the dish is actually deployed.

https://github.com/DMagic1/SCANsat/blob/dev/SCANsat/SCANresourceScanner.cs

Basically, it only runs the code in OnUpdate once the dish is opened.

Link to comment
Share on other sites

moduleType = Scanner/Drill/... What else?

this can just be anything and the GUI will display "Deploy Scanner" or "Deploy Drill" etc (I tried some random words and that was what changed at least) I think maybe it also looks for the module to tie to, since it is in the ISRU as "Converter" and the moduleresourceconverter doesnt seem to reference it at any point) was hoping it would work with science for something im trying atm but no luck so far.

also using it without it being referenced by anything and without a loop animation is returning me pretty neverending "[RESOURCES] - ERROR IN OnUpdate of ModuleAnimationGroup"

It does, however, work alongside a moduleanimategeneric so it allows a way for 2 animations on a part without additional plugins, I just cant get it to work for 2 different science experiments on the same part.

Edited by Squiggsy
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...