Third Person Controller

Hi everyone

I’m having problem with Unity Build in Third Person Controller (Assets > 3RD person Controller). I have shooting animations in my character (Empty Hand Animation, and with gun animation), but i don’t know how to add Shooting animation in ThirdPersonController.js.

I’m trying to add _characterState = CharacterState.Shooting in Update Function but nothing happens (if(_characterState == CharacterState.Shooting) _animation.CrossFade(shootAnimation.name);


thanks for the answers.

Hi,

You say that you have shooting animation on the character, so if its called “Shooting” all you have to do is call it when you either press a key or a GUI button on iOS. Something like below, with the script attached to the character that has the animation attached to it.

function Update{
    
    if(Input.GetKeyDown(KeyCode.Space)){    // Call function ShootWeapon when Space is pressed
        ShootingWeapon();
        }
    }
    
function ShootWeapon(){
        animation["Shooting"].layer = 1; // Place the animation on a higher level to override the Walk animation
        animation["Shooting"].wrapMode = WrapMode.Once;	// Play the animation once all the way through
        animation.Play("Shooting");						// Play the animation
}