3rd person weapon stance??

Hi, I’m new here…
been trying to make a 3rd person game, with ability to change weapon by pressing key 1, 2, 3, 4, etc…
eg:
key 1: melee attack
key 2: handgun
key 3: machine gun
key 4: grenade

my question is:

  • what’s the best method to switch animation between character’s weapon stance?

a. make different prefab for each stance?
b. with one prefab, handle the animation with a script?
c. any other suggestion??

  • is there any way to change AnimationClip trough script? eg:
var idleAnimation : AnimationClip;

function Start ()
{
animation.Play(idleAnimation.name);
}

function Update ()
{
if (Input.GetKey("1"))
//what should i do here?? 
//I want to change the "idleAnimatio"n to other animation 
//(something like "gunidle", or "machinegunidle")
}

please enlight me :wink:

Hi, welcome to the forum!

You can blend animations smoothly into each other by using the CrossFade function. It is also possible to combine animations, so you can modify say a simple walk into a gun-carrying walk. See this section of the manual for more information on animation blending.