I’m working on an rpg style game and I am going to have replaceable parts, like armor etc… I use Blender for my modeling/animating… and I have run into a bit of an issue.
If I separate the mesh into pieces in blender, but keep it as 1 object, it works fine besides a small seam where it was cut off. That is fine and only noticeable because the character has no texture, just a solid color.
Anywho… I tried saving the pieces like Torso, Head, Hands, Legs and Feet separately. The armature/rig is another file too.
I imported the 6 separate files and placed the body parts onto the rig. They all lined up in place just fine, but the problem is… they don’t deform or react to the armature at all.
I’m trying to do this so later on I can swap out parts, like gloves… and have it animated the same way. Does anyone know what I can do to get this working?
Make the meshes separate objects and keep them all, and the Armature, at the same blend file. Once in Unity, you will get them all as different meshes parented to the same GO, and you will be able to hide/show them on demand by script.
So in the end, my .blend file will be 1 armature with a bunch of overlapping armors, weapons and stuff? Then I just hide all except the “equipped” one in Unity?
Yes, it works fine.
i read somewhere, that it’s not good to have several meshes attached to the same armature. i don’t remember where or why… probably “only” performance related. did you run into any problems before, gusM?
Maybe on extreme cases, but it works fine for most projects I have worked on.
If you’re looking for extra info, it looks like the “Advanced Inventory System” does exactly what you want (have a look at the webplayer).
http://forum.unity3d.com/viewtopic.php?t=57849&start=0&postdays=0&postorder=asc&highlight=inventory
It’s cheap so you could purchase it to see how it works (or to use it directly if it fits your needs).
Yes, that sure is a neat system o.O So far I’ve been practicing making alternate body parts in Blender and manually hiding/showing them in Unity to practice with the seams/texturing etc. I think the actual inventory will have to come later, as I am a complete idiot at scripting. So far my greatest accomplishment is adding a .hit into a TornadoTwins tutorial script to make the explosion happen where the bullet impacts and not at the center of the object I hit. I still have to get a basic combat system setup before I start setting up all these items. It is nice to know what I have to do though for that in the future and I am definitely going to work on that. Modeling is the part I can do, so I will model more armors etc until I figure out how to script it all in. I did get the free versions of the inventory and health bar system. Maybe I’ll pay for the other one in time. Thanks for the responses ![]()
By the way, it seems to say it only has to render however many meshes I have set to render and it only says it is using 1 animation. I don’t know much about Unity, but performance wise, I don’t think it would be a problem because it isn’t even rendering the parts that are invisible. Seems to work just fine so far~
@GusM : Thanks, good to know ![]()
#Zombies1: I was initially worried not about the Animations, but about skinned mesh renderers, where you would have one for every piece of the model you do, resulting in more drawcalls per character.
But i guess it depends on the project. the more players you have on screen at the same time, the less drawcalls you should generate per character.
Maybe you could somehow merge the meshes back together after customizing by the player via scripting.
Well, scripting is something I really don’t know much about, so I wouldn’t know. When I run the game with the play button, I have it display whats going on… and it says 5 skinned mesh renders, but there are really 10 objects. 5 are hidden, 5 are visible. That’s good right? I mean, that’s how it should be?
the skinned mesh renderers are in addition to the draw calls if i’m not mistaken.
when you drag the player prefab (with the skeleton/armature and the different mesh pieces) into a new scene, what does the stats-window in the game say?
also look at the draw calls.
ideally you would have 1 draw call and 1 skinned mesh renderer. if you use different materials on different parts of the model, you will probably have more draw calls already.
but now after writing this, you best just go on with the project. do it the way you want to have it and then optimize later. it’s better to have it running first and then go back and make it better.
I have gotten some progress this way, however… I run into a bit of an issue when I try to add geometry to one of the pieces. For example, putting a little extrusion around the waist line on the pants area, like for a belt or just the top of the pants. I can’t seem to get them to deform the right way. Is there like an “average/blend” tool for weights in Blender? I can’t re-create the weights by parenting to the bones and using bone heat, because then the seams don’t line up anymore and I would end up with open spots on my character. I have already gotten quite a bit of help from this topic, just a little more before I can create some better stuff. ![]()
if you can, you best model some overlap. it’s possible that some kind of mesh compression or maybe some later lod-system will put your vertices off a little. especially with animation. so just close some of the parts of your model with geometry and it should give you some room for looseness.
oh and for the mesh-to-bone assignment. you maybe should take a look into vertex paint if you haven’t already (sounded like it from your post). there are lots of tutorials out there.
So like an inner layer of “skin” sort of, so if someone sees through the parts they see a color close to the armor/mesh… instead of seeing through the other side of the armor? O.o Basically a plane to cover seams? Just wanna make sure that is what you meant.
i meant something like this:
close off the meshes where you cut them into pieces and pull them in or out a little, so they overlap with the other mesh nearby. make sure the faces there have some sort of similar material to the actual object. that way, if it comes to holes, they won’t be that visible.
so for example if you have the head of a knight, you would probably cut it at the neck so you can switch the armor. extend the neck by some faces and push them a little down inside the armor. then, on the armor you could select the edgeloop where the neck was and extrude it a little towards the center of the armor. then close that hole up and maybe texture it a little darker.
you basically always want to have one piece overlap the other piece by a little amount.
Alright, I think I understand o.O I’ll work on that shortly. I was also wondering if my character is able to use swords, daggers, spears, bows etc… do I need to have the armature/rig for the bow built in to my character and have the same invisible thing for the weapons too, not just the armor? and later on have it change animations based on what is equipped in script? If that is accurate, is there any tutorial or beginner inventory system for equipping stuff? Even if it’s just a simple button click to change the visibility of a mesh, that would be plenty fine for now. Stats and stuff doesn’t matter for now. I have that free example of the inventory one but I haven’t been able to understand it so much. ![]()