I’ve recently added an animation to my character and now he won’t move! the animation plays and he can rotate but he won’t walk forward or backwards. Any help?
Anyone? im really stuck and i can’t move on until i figure this out. please.
Can you post the code you are using to control the character?
if you mean the code that i makes him move, (Sorry im a noob )then here:
var speed = 3.0;
var rotateSpeed = 3.0;
function Update ()
{
var controller : CharacterController = GetComponent(CharacterController);
// Rotate around y - axis
transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
// Move forward / backward
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis ("Vertical");
controller.SimpleMove(forward * curSpeed);
moveDirection = Vector3(0,-Input.GetAxis("Vertical"),0);
}
@script RequireComponent(CharacterController)
and i have a walk animation script which is this:
function Update ()
{
if (Input.GetAxis("Vertical") > 0.2)
animation.CrossFade ("walk");
else
animation.CrossFade ("idle");
}
It looks OK, actually. Check the value of the speed variable in the inspector. If it has been set to zero or some other value, this will override the value set in the script.
Please anyone tell me how can I add controls to a object in unity. I am a absolute beginner. Please help me.