johnq
New vMember
Posts: 12
|
Post by johnq on Oct 31, 2019 21:00:01 GMT
I am currently working on an armour system. I have the items created and extra equipment slots fine, I also have multiple different models of the same character in different armour sets. I am wondering if there is a way to change my character controller model without having to create several different character controllers and switching them as having multiple controllers will prove problematic, possibly slow and a pain editing.
What I have is a single main controller and I am trying to figure out if there is a way to change the characters model/mesh within the controller itself while keeping the same armature as to avoid loss of all IK and everything else.
All my models were rigged with mixamo and thus have the same armature. Can I multiple character meshes linked to the same armature in the controller and simply deactivate and activate the meshes to change armour? I tried this but it did not seem to work.
Sorry if my English is bad, but I am basically looking to see if it is possible to have one invector character controller have the ability to use multiple different humanoid models to act as a character change, thus avoiding the need to have several different and separate character controllers which will prove troublesome.
|
|
johnq
New vMember
Posts: 12
|
Post by johnq on Nov 5, 2019 15:00:55 GMT
I may have made the question way too over complicated, so I will try to rephrase in Hope of any help: to put it simply I am looking for a way to replace my character controllers model at runtime (to act as armor changing) without having to create multiple separate character controllers as switching between them is inconvenient. Any help would be appreciated, thanks in advance.
|
|
|
Post by Invector on Nov 5, 2019 23:11:03 GMT
Hmm, we don't have this option out of the box, especially since it's a simple task to do... But, if you have models that are using exactly the same Rig (bone names, position, rotations, and sizes) you could use our BodySnap system to control all the attachments, for example, all of the handlers and transforms that you normally attach directly to a bone, you can now have into a single gameObject and assign a bone to parent when you start the game.
This would help you create character prefabs faster, but it still not a solution to change models in real-time, for that the best approach would be to have the character 3d model inside the Controller object, and you would need to reload a few methods like, assigning the new animator once you replace the model... again it's not something easy to do, so I'm just speculating.
|
|
|
Post by uberwiggett on Nov 9, 2019 23:55:16 GMT
Another method if they use the same skeleton structure is to add each of the meshes onto the one skeleton. Then just hide the mesh and create a script that activates and hides each mesh depending on what item you equip. There is a skeleton switch scriptfor unity floating around github somewhere
|
|
johnq
New vMember
Posts: 12
|
Post by johnq on Nov 10, 2019 15:20:39 GMT
Hmm, we don't have this option out of the box, especially since it's a simple task to do... But, if you have models that are using exactly the same Rig (bone names, position, rotations, and sizes) you could use our BodySnap system to control all the attachments, for example, all of the handlers and transforms that you normally attach directly to a bone, you can now have into a single gameObject and assign a bone to parent when you start the game. This would help you create character prefabs faster, but it still not a solution to change models in real-time, for that the best approach would be to have the character 3d model inside the Controller object, and you would need to reload a few methods like, assigning the new animator once you replace the model... again it's not something easy to do, so I'm just speculating. Thanks for the advice, after playing around I managed to get a system working where the models are swapped and all components are transferred to the new models rig. Everything works fine however there is an IK issue where the new player model will not update rotation when aiming, I assume since the aim IK is still linked to the old models bones. Could you be able to tell me which script stores the bones that are updated when aiming so I can add some code updating this also? My armor change system will be perfect then Another method if they use the same skeleton structure is to add each of the meshes onto the one skeleton. Then just hide the mesh and create a script that activates and hides each mesh depending on what item you equip. There is a skeleton switch scriptfor unity floating around github somewhere This is what I originally wanted to do. I couldn't find any scripts online previously so I tried to make one myself but I encountered too many issues trying to get separate models to work on one rig (the new model would be invisible at runtime for some reason) so I had to go about it a different way. It would be much more optimised to do it this way just changing the mesh but I couldnt seem to figure out how to get multiple models being animated by one armature object.
|
|
|
Post by uberwiggett on Nov 10, 2019 23:28:25 GMT
It really depends on how similar the skeletons are. Synty models do this often natively as they release all their characters on the one skeleton and you just switch between meshes. But if you're using models from different artists you're going to find issues there is definitely a combine skeleton script on github as i used it a few years ago. But no idea what it was called
|
|
johnq
New vMember
Posts: 12
|
Post by johnq on Nov 11, 2019 0:13:51 GMT
It really depends on how similar the skeletons are. Synty models do this often natively as they release all their characters on the one skeleton and you just switch between meshes. But if you're using models from different artists you're going to find issues there is definitely a combine skeleton script on github as i used it a few years ago. But no idea what it was called All the models I am currently using were created in Adobe Fuse and are the same base character, just with different outfits. They were all rigged by mixamo and thus have the same armature (bone sizes, name, etc). I just cant figure out how to get multiple character meshes animated by a single armature gameobject. I had a quick look around in GitHub but couldnt seem to find it. I'll probably look around again another time as this way would be 100x more optimised than what I am currently having to do.thanks for the tip and response.
|
|