Jump to content

Multiple Animations on part


Recommended Posts

So I am trying to make a part that has multiple animations on it. I was able to successfully able to export it from blender to unity and it "works" fine but I am having an issue ingame with it. For some reason when I load the part up it starts halfway between BOTH animations instead of at frame 0. If you right click the part it shows both animations in the undeployed state as it should be. I have to deploy and undeploy the animation to get the part to show as it should, at frame 0. This persists even after load the ship from VAB to pad.

I was originally trying to use animategeneric but gave up as it doesn't have enough control for what I am trying to do. I switched to using firespitters fsanimate and it is working a lot better but I have the same issue with it starting half deployed between both animations instead of at the first frame.

Here is my cfg code for the animations:


MODULE
{
name = FSanimateGeneric
animationName = Inflate1
startEventGUIName = Inflate
endEventGUIName = Debug Deflate
toggleActionName = Toggle Inflate
startDeployed = False
// Animation Layer. If you have more than one animation on a part, this must be unique for each one in order for them to not interrupt each other. If the stock engine heat animation module is used, that’s probably on layer 0, so make this 1 or higher.
layer = 1
playAnimationOnEditorSpawn = False
useActionEditorPopup = True

// If you have more than one FSanimateGeneric on a part, give each a unique ID to. This makes the popup menu appear in a separate location for each module, and not steal each others windows. values: 0-9.
moduleID = 0

}

MODULE
{
name = FSanimateGeneric
animationName = Deflate2
startEventGUIName = Deflate
endEventGUIName = Reinflate
toggleActionName = Toggle Deflate
startDeployed = False
// Animation Layer. If you have more than one animation on a part, this must be unique for each one in order for them to not interrupt each other. If the stock engine heat animation module is used, that’s probably on layer 0, so make this 1 or higher.
layer = 2
playAnimationOnEditorSpawn = False
useActionEditorPopup = True

// If you have more than one FSanimateGeneric on a part, give each a unique ID to. This makes the popup menu appear in a separate location for each module, and not steal each others windows. values: 0-9.
moduleID = 1

}

Here are pictures showing what I mean:

Javascript is disabled. View full album
Link to comment
Share on other sites

looks like you can use ModuleAnimateGeneric and include the AnimSwitch = true flag; that will play the Inflate animation in reverse. Might wanna check out RoverDude's deployable airbags and see how that's setup. looks very similar to what you are trying to set up here.

http://forum.kerbalspaceprogram.com/threads/83134

Link to comment
Share on other sites

I already tried that, if I reverse it the bags start open instead of half open and I still have to toggle them closed on launch. So it doesn't really solve the problem. For instance using that switch makes it start on frame 25 so the bags are open. If I don't use that it appears to start on frame 12 and frame 38 at the same time.

Link to comment
Share on other sites

yeah, you only need 1 animation, Inflate. In the animation component, only assign 1 animation; Animations list size is 1, and the entry in the list is the same as the Animation field above it. so the deflate clip is not exported to the mu.

moduleAnimateGeneric would look something like this

MODULE

{

name = ModuleAnimateGeneric

animationName = Inflate1

startEventGUIName = Inflate

endEventGUIName = Deflate

actionGUIName = Deploy Air Bag

animSwitch = true //technically not necessary as it defaults to "true"

}

Looks like the animation isn't loading correctly in your screenshots. check the cases and names in the module and unity settings and make sure you are using legacy animation. also check the animation make sure there aren't keyframes on attributes other than the ones you need to make it inflate and deflate. Only one of the event names should be visible depending on where the animation is on frame 0 or frame 25.

Link to comment
Share on other sites

There has to be 2 animations. The first animation inflates the airbags and shrinks the outer covering to size 0. The second shrinks the airbags to size zero while LEAVING the outer covering at zero. If you just take the inflate and reverse it the airbags will shrink but the outer covering will still be there which I don't want.

Link to comment
Share on other sites

Ooooh you mean the gray egg is the casing... the brown ball is the air bag.

hm... are both pieces keyframed in both animations? might need to do that in the deflate animation, even thought the egg doesn't do anything, Unity needs to know the starting state of that piece in the deflate animation. in other words.

in Inflate; Airbag scales up, 0 ~ 1; egg shell scales down 1~0

in Deflate; Airbag scales down, 1~0; egg shell stays scaled at 0 ~ 0.

Link to comment
Share on other sites

Actually the "grey egg" is a separate part. It doesn't change at all, it has the "brown bag" placed on top of it. I'll try to explain the sequence better. First, you have the brown covering. When you click inflate, the brown covering should shrink to 0, the yellow airbags should inflate from 0 to 1000. When you hit deflate, the yellow airbags should shrink back to 0 and the brown bag will stay at zero. The grey egg is a separate probe part with it's own cfg and animations. It sits "inside" the airbag part which basically becomes invisible around it once deflated although it is still technically there.

The yellow airbags and brown bag are keyframed separately using the action editor in blender.

Link to comment
Share on other sites

I see. I'd definitely check out RoverDude's inflatable airbag part then. maybe the stock parachute code could be more useful than genericAnimate module. this is kind of like a parachute that looks like something else.

Edited by nli2work
Link to comment
Share on other sites

I checked out his parts. His airbags are a single inflate/reverse-inflate animation. His custom library is good for adapting the bounce module to better suit an airbag but it doesn't seem to have anything to do with animation. It's looking like I'll need to separate the airbags and covering into two separate parts which I didn't want to do.

Link to comment
Share on other sites

The only error pertaining to this is the general Compute mesh inertia tensor failed when you have a collider that has a zero value. This shouldn't have anything to do with the function of the animation, I test it with the colliders disabled so this error doesn't show up for testing.

Link to comment
Share on other sites

I checked snjo's docs, don't see anything else that might help. :/ can't think of a solution that would use only 1 animation either, except a very long deflate duration; but that's very hacky and not a great way to do it.

Link to comment
Share on other sites

  • 2 weeks later...
The only error pertaining to this is the general Compute mesh inertia tensor failed when you have a collider that has a zero value. This shouldn't have anything to do with the function of the animation, I test it with the colliders disabled so this error doesn't show up for testing.

Maybe too late - but for reference:

first - inertia tensior is because you try to add a collider to a plane..

use in blender "solidify" on that plane or merge it with an other mesh peace - that solves it

second - I've managed to import several animations from one blend file to unity by adding the key frames after each other..

in unity you can set a start and end time/frame for each animation you import..

that way you can seperate them..

however - to call them independently I was using a plugin and called the animations by script..

so - not sure if there is a way to call them any differently..

that generic animation thing is "one only per part".

I havent tested any of the available animation modules - so I can't say if they could help..

Link to comment
Share on other sites

I just kind of skimmed over the thread but I just wanted to suggest the easiest thing. Are sure you saved it at frame 0 in blender or whatever you made it in?

Two separate animations can be done successfully

JointCrazyFossa.gif

Link to comment
Share on other sites

  • 1 month later...

does that mean, that animations run independantly - so if I open door 2, door one will not be changed?

I mean if you have the door1 on frame 1-100 and door2 on frame 100-200, if you run the door2 animation, door1 will allways be at it's end state.

that's annoying - does your code solve that issue?

maybe a ingnorant question.. sorry...

Link to comment
Share on other sites

Hi, the easiest way to do multiple animations is simply to animate each part in unity, I originally messed around with animating in my chosen modelling software and then split the animation in unity , but the results where mixed and mostly not satisfactory. Once you get used to the animation editor in unity it's much easier than messing around splitting clip.

Below is an example of a recent project that was totally animated in unity and it all works perfectly, I believe it's because the unity animation doesn't reference the models root in the same way that many modelling applications do. ( this is likely the wrong reason but i'm no expert)

Xvb2190.png

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