Jump to content

Multiple animations on a single part.


Recommended Posts

Let's say I was working on a cargo bay which has three separate doors: The main payload doors and two side doors for kerbals to walk through. Do i need to break up the bay into separate animated parts or can I have separate buttons for each of them? If so how do I do that?

Link to comment
Share on other sites

Are you talking about using a plugin? I guess you could try multiple ModuleAnimateGeneric modules with multiple animations, but that doesn't seem very elegant and I don't know if it works. You also don't have much control over how animations work with the generic module.

For a separate plugin I think the easiest way would be to make three animations and have three [KSPEvents] to toggle them, and presumably something to make them work on EVA too. It's probably also possible to make one really long animation with all of the possible door combinations then make your plugin call the animation at different time points, but separate animations is probably easier.

You can check the source code for my BTDT scanner, or a find some other part with multiple animations (Kethane has some parts, and Majir released a code snippet related to setting up animations that might help) to get an idea of how to setup the plugin.

My part and the source code is available here: http://forum.kerbalspaceprogram.com/threads/64755-WIP-DMagic-Orbital-Science-New-Science-Parts-V0-5-%281-31-2014%29

Link to comment
Share on other sites

You can use multiple ModuleAnimateGeneric. However, it's kinda buggy. The game seems to confuse the different animations and unexpected stuff happens.

You could try out the firespitter plugin, it has an animation module that's a lot more versatile.

Link to comment
Share on other sites

Not that I'm aware of. I'd recommend getting on the modding room on the IRC chat (irc.esper.net is the server and #kspmodders is the channel) and asking there. I know Nothke is there occasionally and he's used Firespitter for his 6S Service modules. So he knows at least SOMETHING about it.

Link to comment
Share on other sites

You'll definitely need to make separate animations for each door and put them all on the same part. There are a few ways of doing this. Making animations in Unity would probably be the simplest way, I think there are some tutorials on these forums about doing that.

It's also possible to import multiple animations from Blender, if that's what you're using. Unfortunately I don't know of any simple way to do this. You can do it using armatures (using invisible "bones" within your model to rotate objects), but that isn't always so simple, and I've had some issues with importing armature animations into Unity.

The other option would be to create your model in Blender with all of the doors closed, then make the animation for one door only. Import this and the single-door animation into Unity. Then do the same with the other two doors. You can then copy the animation clip from each model in Unity and combine them into one model. I'll try to add a picture demonstrating this later, it should only take one to cover it.

That way you would have a single model that could be exported into KSP with three different animations. Then you can move on to figuring out how to get them all working together.

Link to comment
Share on other sites

  • 2 years later...

Well, i see this post have a age, but i need this type of solution, for multiple animations (that i can make inside Unity, with pivots and parents), but still don't see how to make it work on Ksp.

Is there now a solution for this already?

And a tutor?

My model will have parts with two windows and two hatches, all need to work separately.

 

Link to comment
Share on other sites

I can safely tell you that multiple animations on one part do work.  In my sig, the 'Idiot Lights' has 8 animations.  And, until I shut the bloody buttons off, they all worked by clicking the buttons on the GUI.  I do control it now with a plugin though.

There are tutorials on how to make animations from inside Unity on these forums and that's how I do all of mine, inside Unity.  It's pretty straightforward.  You create the new animation in Unity by selecting a GameObject, clicking on the Animation tab and add the object you want to animate. Make sure the 'record' button is depressed, then move your part.  Two things thing you have to watch is: Unity WANTS you to have an ANIMATOR on the Game Object.  You need to remove that and instead, drag the ANIMATION onto the GameObject when you're done.  And Unity INSISTS on trying to keep that record button ON even after you turn it off. So if you add in new stuff and move it around, it'll try to add it to the animation.

The only place where this gets even more difficult is with emissives (doing lights and such) because those are still considered legacy animations and require manual editing of the animation file.

Link to comment
Share on other sites

Great, and all this work with the stock animation module? Or i use a know plugin?

I'm studying this moment Quiztech Aero Parts that use more than one animation in some parts to see how he did, and try it here.

But the part of doing the animations inside GameObject on Unity, is the way i gonna do.

Thank you.

Link to comment
Share on other sites

If you're just moving parts around in the animation, yes, Unity can do all that for you and, if you get the .cfg file right, the buttons to run the animation will be on the part's GUI.  Multiple animations will require multiple MODULE entries into the .cfg.  You don't need a plugin just to move parts IF you only want the end user to move them.  IF you want those parts to move automatically based on some event that happens to the ship, then yes, you'll need a plugin.

YW and good hunting.

Link to comment
Share on other sites

  • 8 months later...

Sorry to necro this, but does this implicitly say that the creating a sequence of animations in blender is not the way to go? I find the second animation automatically continues where the first one left off, while I would like them to be independent.

I found some blender examples that play all animations simultaneously, but in ksp are separate (eg. ladder and landing gear on the dragon) However i don't know how to set it up in unity.

Link to comment
Share on other sites

25 minutes ago, MacLuky said:

Sorry to necro this, but does this implicitly say that the creating a sequence of animations in blender is not the way to go? I find the second animation automatically continues where the first one left off, while I would like them to be independent.

I found some blender examples that play all animations simultaneously, but in ksp are separate (eg. ladder and landing gear on the dragon) However i don't know how to set it up in unity.

Animate separate, you can do it on your 3D program, but it is better to animate on Unity.

There you can have each animation on an exclusive channel. In the 3D program you have only one time line, so, you would need to do one animation for each step of time, like 0 to 5, 6 to 10, and then separate each on Unity, so, do in Unity is so much easier.

Then to have the animations play simultaneous in KSP, generic animation stock don't do it. I use the animation module from firespiter, because it have a way to associate soundfx too.

Hope that helps.

 

Link to comment
Share on other sites

Yes, it's probably the way to go. Since the animations are sequential in blender I cannot play the second animation without the endstate of the first. Hence when I deploy my drill, the landing gear jumps to its extended position since i first animated the gear and then the drill.

Joy, another skill to learn ;-)

Link to comment
Share on other sites

MacLuky you can animate things in Unity. The legacy animator is not very intuitive, but it works. You can create as many animations as you want without having to bother splitting this stuff. Material animation doesn't work in Unity 5 though.

Edited by Enceos
Correction
Link to comment
Share on other sites

3 minutes ago, Enceos said:

MacLuky you can animate things in Unity. The legacy animator is not very intuitive, but it works. You can create as many animations as you want without having to bother splitting this stuff. Doesn't work in Unity 5.

It works in Unity 5. I use it, i did all my mod with it. It have some minor B turns for emissives, but it works.

Edited by Climberfx
Link to comment
Share on other sites

@Climberfx Yeah, you're right. I probably used Unity 5 at some point, but had to revert to Unity 4, not only because of emissives. Unity 5 doesn't support any material property animation at all. The curve tool which comes with the latest PartTools for Unity 5 is very basic and is good for lights only.

Sometimes I use the Ctrl+D hotkey to extract the animation from the model file. Animations extracted to a separate file are editable. I optimize these animations, manually delete all the extra keyframes Unity creates, and reapply to the part. One can make several different animations for a model in Blender and save them all as separate .anim files in Unity.

Link to comment
Share on other sites

Simplest solution was to copy the model and create 3 different blender files, each with only one animation. Then load all three in unity and that works as a charm. For my next mod I'll dive into unity animation since this looks indeed the way to go. 

Thanks for all the pointers, all the little steps illuminated my ignorance step by step ;-)

Link to comment
Share on other sites

32 minutes ago, Enceos said:

@Climberfx Yeah, you're right. I probably used Unity 5 at some point, but had to revert to Unity 4, not only because of emissives. Unity 5 doesn't support any material property animation at all. The curve tool which comes with the latest PartTools for Unity 5 is very basic and is good for lights only.

Sometimes I use the Ctrl+D hotkey to extract the animation from the model file. Animations extracted to a separate file are editable. I optimize these animations, manually delete all the extra keyframes Unity creates, and reapply to the part. One can make several different animations for a model in Blender and save them all as separate .anim files in Unity.

There are some workaround for any material animation. When you got used, is super simple.

I don't remember the link page, but you can find it with a goggle search. It include some edit on the anim file...

Edit: found it:

 

Edited by Climberfx
Link to comment
Share on other sites

@Climberfx Interesting, I wonder if it works with all material properties this way. The current color animation tool from Squad works flawlessly for such small tasks in Unity 5. My material animations have too many variables, I couldn't do them with the tool.

 

Edited by Enceos
Link to comment
Share on other sites

58 minutes ago, Enceos said:

@Climberfx Interesting, I wonder if it works with all material properties this way. The current color animation tool from Squad works flawlessly for such small tasks in Unity 5. My material animations have too many variables, I couldn't do them with the tool.

 

Well, i use this method (the one i showed) for a bunch of different types of animation, but not all.

Never used this Color Animation Editor.

So, have a try and let us know!

Edited by Climberfx
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...