- Home /
Question by
hugemaggot · Dec 12, 2010 at 04:29 PM ·
animation
my animation script does not work
i have wrote a script that should when i press the "W,A,S,D" keys my character walks forward,backwards an idles. but when i press the keys wasd my character moves but it dosent do the animation that ive created please can anyone help?
var maxWalkSpeed = 10.0;
var maxTurnSpeed = 100.0;
function Update () {
// Get the horizontal and vertical axis.
// By default they are mapped to the arrow keys.
// The value is in the range -1 to 1
var walkSpeed = Input.GetAxis ("Vertical") * maxWalkSpeed;
var turnSpeed = Input.GetAxis ("Horizontal") * maxTurnSpeed;
// Move translation along the object's z-axis
transform.Translate (0, 0, walkSpeed * Time.deltaTime);
// Rotate around our y-axis
transform.Rotate (0, turnSpeed * Time.deltaTime, 0);
}
Comment
You may want to post the animation script itself - the above script doesn't touch animations, and probably works with WSAD
you're telling it that you want to move, but you're not saying that you want to play the animations while you're moving in the script.
Your answer
Follow this Question
Related Questions
I need help writing an animation script for a Bow and Arrow weapon 1 Answer
animation script help 0 Answers
Unity3D AI using animations 1 Answer
Simple Attack Script Problem 2 Answers
animating character 1 Answer