Third Person Controller. Need Help

Hi! I’m new to scripting and trying to create third person controller script for my character alike in Resident Evil (1,2,3) games or something like this. I’m using a few methods I’ve already learned to control my character like moving forward and backward with “w” and “s” buttons f.e. and rotating with “a” and “d” just like in RE. Now I’m brainstorming a few problems: I wonder how can I make my character sprint with let’s say “shift” button pressed but only when moving forward. Also I need targeting action with f.e. “ctrl” button pressed and the ability to rotate my character when targeting. Here’s a code:

@script RequireComponent(CharacterController)

public var idleAnimation : AnimationClip;
public var walkAnimation : AnimationClip;
public var runAnimation : AnimationClip;
public var shootAnimation : AnimationClip;

public var walkMaxAnimationSpeed : float = 0.75;
public var runMaxAnimationSpeed : float = 1.0;
public var shootAnimationSpeed : float = 1.15;

private var _animation : Animation;
private var _characterState : CharacterState;

var walkSpeed = 2.0;
var runSpeed = 6.0;
var rotateSpeed = 3.0;
var Fireball:Transform;

function Update ()
var controller : CharacterController = GetComponent(CharacterController);
animation.wrapMode = WrapMode.Loop;
   if (Input.GetAxis("Vertical") > 0.2)
       animation.CrossFade ("walk");
      animation.CrossFade ("idle"); 
      (Input.GetAxis("Vertical") < 0.0)
         animation.CrossFade ("walk");
transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = walkSpeed * Input.GetAxis ("Vertical");
controller.SimpleMove(forward * curSpeed);

var bullit = Instantiate(Fireball, gameObject.Find("fireballspawn").transform.position,Quaternion.identity);
bullit.tag = "PlayerProjectile";
bullit.rigidbody.AddForce(transform.forward * 2000);


@script RequireComponent(CharacterController)

There’s a rough copy of shooting action for the character but it’s not finished and even tested yet. Thank’s in advance for your help!

Hi To make your character run its just as simple as above

Here’s a snippet

var move:Vector3;
//ommited all others
function Update(){
//ommited all others
if (controller.isGrounded && Input.GetButton("Sprint") && !crouch){
forward = new Vector3(0,0,Input.GetAxis("Vertical"));
forward = transform.TransformDirection(move);
forward *= runSpeed;
controller.Move(forward * Time.deltaTime);

And by targetting system do you mean to raise the character’s hand or make the character to point at something automatically.please do tell more about it

hi,here is the aim script it a basic one all it does is it makes the hand to go to aim position if you press fire if not it comes back
(if you want a more advanced one that keeps it in that position for some time and then lowers it then please do ask But i wont be able to post it quickly cause i kinda busy with my exams sorry)

var Aim_Anim:AnimationClip;
var RUpperArm:Transform;
function Start(){
animation[].layer = 1;
animation[animation[].wrapMode = WrapMode.ClampForEver;

function Update(){
//in your other code ie run or walk anim add animation[].RemoveMixingTransform(RUpperArm);

animation[].speed = 1;
animation.CrossFade(;//you can also use animation.Play
animation[].speed = -1;
animation.CrossFade(;//you can also use Play