Jump to content

Importing animations from Blender to Unity?


Recommended Posts

I am not that good of an animator with blender but I have been modeling some stuff in Blender for my new Unity game but how do I add an animation in it without having to use the Unity animation editor? I want to have like the walking, running, jumping, and idle poses for my character and also an animation for landing gear on a plane that would also be able to collide while the animation is moving just like ksp.

Link to comment
Share on other sites

I am not that good of an animator with blender but I have been modeling some stuff in Blender for my new Unity game but how do I add an animation in it without having to use the Unity animation editor? I want to have like the walking, running, jumping, and idle poses for my character and also an animation for landing gear on a plane that would also be able to collide while the animation is moving just like ksp.

yeah me too I am modeling at Blender but I dunno how to put em to unity xD

Link to comment
Share on other sites

Ok its not playing the animations when I try to walk. I used the default third person controller and I could move and all that and I even put the animations in the idle,walk,run,jump places and removed the construction worker and only put the contents of the character in it but they are not playing?

Link to comment
Share on other sites

I created a part in blender. Animated of course. FBX to Unity. I click the asset and the animation tab. I can see a preview of my part in action in the little preview window. (here it works fine from what I can see) However getting it to do ANYTHING in KSP or the main window is annoying the crap out of me. Can anyone assist?

Link to comment
Share on other sites

I'm having the exact same problem, i've spent the last day modelling a Pod with 4 walls that fold out that work perfectly. i can export it to unity and preview it the animation just fine, but getting the animation in game window unsuccessful. i believe it needs to be triggered.

have not tried exporting to kerbal yet because it's not finished though.

Link to comment
Share on other sites

I'm having the exact same problem, i've spent the last day modelling a Pod with 4 walls that fold out that work perfectly. i can export it to unity and preview it the animation just fine, but getting the animation in game window unsuccessful. i believe it needs to be triggered.

have not tried exporting to kerbal yet because it's not finished though.

Link to comment
Share on other sites

HUZZAH! I figured out how to import an animation into KSP :D

I know the hierarchy is completely out of whack.. but it works! HUZZAH I say.

Now the problem: It lags to high heavens >.> help lol.

Edited by Xellith
Link to comment
Share on other sites

Ok its not playing the animations when I try to walk. I used the default third person controller and I could move and all that and I even put the animations in the idle,walk,run,jump places and removed the construction worker and only put the contents of the character in it but they are not playing?

Sorry, are you trying to import an actual figure into KSP with a rig/skeleton animation? Sorry have never bothered to try, no idea .. I would guess it's down to hierarchy. I also didnt know we were allowed to mess around with the internals that much, ie replacing characters in the game.

Link to comment
Share on other sites

any chance you'll describe what you think you did that fixed it?

If you are talking to me Im gonna record how to make a basic part sometime. Though I bet if I try to do that that the animation will fail lol (I pretty much figured it out at around 4am lol) But if you PM me your skype/dolbyaxon information I can try to walk you through it or something.

Link to comment
Share on other sites

Firstly, I appologise if the pics are too large in filesize. Secondly, I appologise if you get lost trying to follow me. Its 3am and I decided now of all times would be good to try and explain this. If you have never created even a simple part for KSP using Unity (such as a standard fueltank or something) then you prolly are gonna struggle with this guide. Its not that its hard to do, its just that I kinda gloss over everything. But welcome to the idiots guide to importing animations to KSP from blender. Not that Im calling you idiots. Its my guide and therefore I shall claim that title.

Step1: Create your model and your animation in blender. Note, if you use custom colliders you will prolly wanna add them here and animate them too.

ea32vm.png

http://i40.tinypic.com/ea32vm.png

Step2: Export as a FBX file format.

Step3: Import it to unity and then add it to your Hierarchy. Select it in the Assets folder (or wheverer you dropped it in unity) and change the scale from 0.1 to 1.0. Then then select the tab listed as "Rig". Change it to "Legacy"

308bbdl.png

http://i42.tinypic.com/308bbdl.png

Step 4: Click the animations tab (next to "rig"). This is where you name your animation and tell unity what frames you want it to use. My habitat animation goes from frame 1 to 300. But my blender has it all the way to 350, so I just manually reduced the max frame I wanted unity to capture in this particular animation. So set your animations name and the frames you want that animation to be. This name is CASE SENSITIVE (or so I recall hearing)

66m2k0.png

http://i43.tinypic.com/66m2k0.png

Step 5: Click your main file thing in the hierarchy to get more options on your part. From here you want to look at the "Animation" tab on the left. Unlock "Play Automatically" unless you want it to play automatically.. whatever floats your boat.

2udwacg.png

http://i42.tinypic.com/2udwacg.png

Step 6. Make sure your colliders are all set!!! If you animated them in blender then they should move the collider around. By now click the little play button will show you your animation in fully working order. (NOTE: YOU MAY HAVE TO CLICK YOUR THING TO PLAY AUTOMATICALLY TO ACTUALLY SEE YOUR THING ANIMATE) You are basically done now.

Step 7: Using the Part Tools, write the file as you would normally. Once its in your KSP parts folder all you should have left to do is add your cfg file. Make sure it includes the following

MODULE

{

name = ModuleAnimateGeneric

animationName = HabitatAnimate

startEventGUIName = Inflate Module

endEventGUIName = Deflate Module

}

Now if you recall, in Unity I called my animation "HabitatAnimate". So my cfg to have "HabitatAnimate" If my animation was called "SHOOOOPDAWHOOOOP" in Unity then my CFG would look like this:

MODULE

{

name = ModuleAnimateGeneric

animationName = SHOOOOPDAWHOOOOP

startEventGUIName = Shoop dat whoop

endEventGUIName = Whoop dat shoope

}

Now in case you are wondering where to put that module thing. Here is my config file that has it working:

"name = SizeDD PDB-CT3

module = Part

author = Xellith

mesh = model.mu

rescaleFactor = 1

node_stack_t1 = 1.0, 7.5030, 1.0, 0.0, 1.0, 0.0, 1

node_stack_t2 = -1.0, 7.5030, -1, 0.0, 1.0, 0.0, 1

node_stack_t3 = 1.0, 7.5030, -1, 0.0, 1.0, 0.0, 1

node_stack_t4 = -1.0, 7.5030, 1, 0.0, 1.0, 0.0, 1

node_stack_b = 0.0, -7.5030, 0.0, 0.0, 1.0, 0.0, 1

node_stack_b1 = 1.0, -7.5030, 1.0, 0.0, 1.0, 0.0, 1

node_stack_b2 = -1.0, -7.5030, -1, 0.0, 1.0, 0.0, 1

node_stack_b3 = 1.0, -7.5030, -1, 0.0, 1.0, 0.0, 1

node_stack_b4 = -1.0, -7.5030, 1, 0.0, 1.0, 0.0, 1

node_stack_rightt1 = 2.0125, 3.5, 0, -1, 0, 0, 1

node_stack_rightt2 = 2.0125, 6.3, 0, -1, 0, 0, 1

node_stack_rightt3 = 2.0125, -3.5, 0, 1, 0, 0, 1

node_stack_rightt4 = 2.0125, -6.3, 0, 1, 0, 0, 1

node_stack_right5 = 2.0125, 1.4, 0, 1, 0, 0, 1

node_stack_right6 = 2.0125, -1.4, 0, 1, 0, 0, 1

node_stack_rmiddle = 2.0125, 0, 0, 1, 0, 0, 1

node_stack_leftt1 = -2.0125, 3.5, 0, 1, 0, 0, 1

node_stack_leftt2 = -2.0125, 6.3, 0, 1, 0, 0, 1

node_stack_leftt3 = -2.0125, -3.5, 0, 1, 0, 0, 1

node_stack_leftt4 = -2.0125, -6.3, 0, 1, 0, 0, 1

node_stack_leftt5 = -2.0125, 1.4, 0, 1, 0, 0, 1

node_stack_leftt6 = -2.0125, -1.4, 0, 1, 0, 0, 1

node_stack_lmiddle = -2.0125, 0, 0, 1, 0, 0, 1

node_stack_back1 = 0, 3.5, 2.0125, 0, 0,-1, 1

node_stack_back2 = 0, 6.3, 2.0125, 0, 0,-1, 1

node_stack_back3 = 0, -3.5, 2.0125, 0, 0,-1, 1

node_stack_back4 = 0, -6.3, 2.0125, 0, 0,-1, 1

node_stack_back5 = 0, 1.4, 2.0125, 0, 0,-1, 1

node_stack_back6 = 0, -1.4, 2.0125, 0, 0,-1, 1

node_stack_bmiddle = 0, 0, 2.0125, 0, 0,-1, 1

node_stack_front1 = 0, 3.5, -2.0125, 0, 0,-1, 1

node_stack_front2 = 0, 6.3, -2.0125, 0, 0,-1, 1

node_stack_front3 = 0, -3.5, -2.0125, 0, 0,-1, 1

node_stack_front4 = 0, -6.3, -2.0125, 0, 0,-1, 1

node_stack_front5 = 0, 1.4, -2.0125, 0, 0,-1, 1

node_stack_front6 = 0, -1.4, -2.0125, 0, 0,-1, 1

node_stack_fmiddle = 0, 0, -2.0125, 0, 0,-1, 1

node_stack_top = 0.0, 7.5030, 0.0, 0.0, 1.0, 0.0, 1

CrewCapacity = 15

cost = 4000

category = Utility

subcategory = 0

title = SizeDD PDB-CT3 Inflatable (Crewtank)

manufacturer = SizeDD

description = A crew tank with inflatable compartments which can house up to 15 Kerbols. Designed for space stations and very large craft.

attachRules = 1,0,1,1,0

mass = 10

dragModelType = default

maximum_drag = 0.5

minimum_drag = 0.5

angularDrag = 2

crashTolerance = 12

breakingForce = 870

breakingTorque = 870

maxTemp = 2000

vesselType = Ship

MODULE

{

name = ModuleAnimateGeneric

animationName = HabitatAnimate

startEventGUIName = Inflate Module

endEventGUIName = Deflate Module

}"

Very messy yes I know. I have to delete like 2/3 of those nodes. lol. Anyways I hope this helps at least 1 person.

Edited by Xellith
Link to comment
Share on other sites

Firstly, I appologise if the pics are too large in filesize.

*snip

Very messy yes I know. I have to delete like 2/3 of those nodes. lol. Anyways I hope this helps at least 1 person.

He is trying to animate figures / skeletons, not rockets as the thread describes. Same does not apply to rigged animations, there is more work involved.

Link to comment
Share on other sites

I read somewhere, that it is not possible to change animaton of EVA. So if you try to edit these movements, then it will never work.

Yeah, I think if it was that easy to import a new kerbal animation, people would have done many of them by now! I just felt sorry for Xellith thats all, he spent all that time posting some help and it had nothing to do with the question :(

Link to comment
Share on other sites

Very messy yes I know. I have to delete like 2/3 of those nodes. lol. Anyways I hope this helps at least 1 person.

Included in my information compilation, it's a nicely laid out tutorial with lots of details. :)

Link to comment
Share on other sites

  • 1 month later...
I am not that good of an animator with blender but I have been modeling some stuff in Blender for my new Unity game but how do I add an animation in it without having to use the Unity animation editor? I want to have like the walking, running, jumping, and idle poses for my character and also an animation for landing gear on a plane that would also be able to collide while the animation is moving just like ksp.

It may be better to ask on the unity forums there are probably more people there that can help

Link to comment
Share on other sites

  • 4 weeks later...
Anyways I hope this helps at least 1 person.

Im one person =)

Awesome little tutorial, very easy to follow even for a noob to Blender/Unity like me. I do have one question in regards to colliders.

This is something Im still rather confused about on the whole honestly....colliders that is.

I did see an older tutorial on Blender showing how to make mesh colliders and tuck them inside the model. Is this the only/best method for adding colliders to an animated part?

Im still kinda struggling with the unity colliders, how to best use them.

edit: Followed this and got a animated doohicky into game. New issue though. When I imported the model+animation into Unity the scale was 1 all across (not 0.1 as was stated above). So I left it as is...the part in KSP was so tiny. It was 2.5meters in blender. Im guessing its the FBX format. Is there a set amount to up the scale in Unity? If it imports as scale 1 will changing to 100 work??

Edited by KhaosCorp
Link to comment
Share on other sites

When I imported the model+animation into Unity the scale was 1 all across (not 0.1 as was stated above). So I left it as is...the part in KSP was so tiny. It was 2.5meters in blender. Im guessing its the FBX format. Is there a set amount to up the scale in Unity? If it imports as scale 1 will changing to 100 work??

I've came across this before, its the way blender exports FBX.. The solution: Unity accepts the .blend format. Just import your blends into unity, the animation name will default to "Default Take" and the scale will be correct.

Link to comment
Share on other sites

I've came across this before, its the way blender exports FBX.. The solution: Unity accepts the .blend format. Just import your blends into unity, the animation name will default to "Default Take" and the scale will be correct.

Awesome! Thank you much. I knew Unity would take a .blend file, but thought it had to be FBX to animations.....very new to modding =)

edit:

Do animations based on scaling a mesh work well/at all in KSP. Im guessing not but figured Id ask.

Edited by KhaosCorp
Link to comment
Share on other sites

How do you get a node to move with an animation ingame? Is it possible to do without a plugin?

No, attachment joints are attached to the top level part GameObject rather than the model (which is a child of the part gameobject) so there's no way the model can affect them.

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