3PS Character Controller Scripting

Hello I’m new to Unity. I’ve imported an animated character into my scene. The character has a walk and idle animation for a Third person shooter game I’m working on. I’ve added some code that allows the animations to play when in game mode. My problem is the character only walks in place when I hit the up button. I think I have to add a ThirdPersonController script but I am not sure. How do I make my character move when I hit the up button?

This is the script I have so far:

var speed : float = 1.0;
var rotateSpeed : float = 3.0;

function Start ()
{
// Set all animations to loop
animation.wrapMode = WrapMode.Loop;

animation.Stop();

}
function Update ()
{

if(Input.GetAxis(“Vertical”) > 0.2)
animation.CrossFade(“wailk”);
else
animation.CrossFade(“idle”);

var controller : CharacterController = GetComponent(CharacterController);
transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
if (controller.isGrounded) 
{
// We are grounded, so recalculate
// move direction directly from axes
moveDirection = Vector3(0, 0,
In

Thanks for any help in advance.

This is class controller : : call this function in update()

void GetLocomotionInput()
{
var deadZone=0.1f;

	TP_Motor.Instance.VerticalVelocity=TP_Motor.Instance.MoveVector.y;
	TP_Motor.Instance.MoveVector=Vector3.zero;
	//If movement in z-axis ie up key pressed
	if(Input.GetAxis("Vertical")>deadZone || Input.GetAxis("Vertical")<-deadZone)
	{
		TP_Motor.Instance.MoveVector+=new Vector3(0,0,Input.GetAxis("Vertical"));
	}
	
	//If movement in x-axis ie down key pressed
	if(Input.GetAxis("Horizontal")>deadZone || Input.GetAxis("Horizontal")<-deadZone)
	{
		Motor.Instance.MoveVector+=new Vector3(Input.GetAxis("Horizontal"),0,0);
	}
	
}

this is class motor : :

void ProcessMotion()
{
//Transform MoveVector to world space
MoveVector=transform.TransformDirection(MoveVector);

	//Normalize MoveVector if magnitude>1 ie to adjust the speed in diagonal motion
	MoveVector=Vector3.Normalize(MoveVector);
	
	//Multiply MoveVector by MoveSpeed
	MoveVector*=MoveSpeed();
	
	//Reapply VeticalVelocity to MoveVector.y
	MoveVector=new Vector3(MoveVector.x,VerticalVelocity,MoveVector.z);
	
	//Apply Gravity
	ApplyGravity();
	
	//Move character in world space
	Controller.CharacterController.Move(MoveVector*Time.deltaTime);
}

This is the moving functionality for the third person shooter…

moveDirection = new Vector3(Input.GetAxis(“Horizontal”), 0, Input.GetAxis(“Vertical”));

moveDirection = transform.TransformDirection(moveDirection);

moveDirection *= speed;

There are a few ways to move the character take a look at the scripting reference, if you are new to Unity read this entire site : http://unity3d.com/support/documentation/ScriptReference/CharacterController.Move.html

ok… if u want to learn step by step u can goto www.3dbuzz.com/vbforum/content.php?212
there are full video tutorials available.