How to have player change skins or weapons in a 3D game?

polycounter lvl 3
Offline / Send Message
wonkza polycounter lvl 3
Hey, this is a very basic question probably but I'm always wondering this and I don't know how it works.  
If I make a 2.5D platformer let's say, I model and rig and animate my main character, then I want him to be able to change the clothes he's wearing and weapon to hold on the hand during the game, like finding new gear on the way and replacing them at will. 

Do you have to redo a rig and animation for every new skin and weapon and just replace it smoothly every time ingame? or is there a way to attach the weapon or skin to the character smoothly?  

Sorry if this question is really basic. 

Replies

  • robert.nally
    Offline / Send Message
    robert.nally polycounter lvl 9
    To change the clothes your character is wearing in-game just change the player model's material.  You could perform this action on a button press.  Just write a script with a public function, get a player reference, get the player's material renderer component, and then change the material to something else.

    For the weapon, I would just parent different weapons to the player's hand and just activate the one the player should be using at any give time and de-activate the others.  You could set something like that up with a button press as well and just write a script to perform those actions.

    You don't have to redo a rig and animation for every new skin or weapon per se, but you may want different animations for a one-handed axe versus a two-handed blade for instance.  Some setup in Unity might be required to use imported animations.  You'll need to mark them as Humanoid and make sure the rig is configured right and Unity read all the joints correctly.  Once you do that (created and setup an avatar) you can pretty much use any other humanoid animation and if you setup masks/layers then you can have different animations for the lower body than from the upper body.
Sign In or Register to comment.