- Home /
Question by
jtcc34 · Jan 27, 2013 at 05:45 PM ·
javascriptrpg
rotation won't work someone please help?
I have this movement script its simple and the moving forward work well and the walk animation plays when the player moves forward but when I rotate the player nothing happens can someone help me with this problum here is the code:
#pragma strict
var walkspeed : float = 3.0;
var rotatespeed : float = 3.0;
function Start () {
}
function Update () {
if(Input.GetButton("Vertical"))
{
transform.Translate(new Vector3(0,0,1) * walkspeed * Time.deltaTime);
animation.Play("walk");
}
else
{
animation.Play("idle");
}
if(Input.GetButton("Horizontal"))
{
transform.Rotate(new Vector3(0,1,0) * rotatespeed * Time.deltaTime);
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613091659im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
A node in a childnode? 1 Answer
how dose this script look? 0 Answers
combat grid not working 2 Answers
convert c# to JavaScript Problem 0 Answers
How can I tell Unity to wait to do something until after and animation has finished playing? 0 Answers