I’m using Javascript and I can’t figure out how to turn the character model. This is the code for the movement script:
#pragma strict
var speed = 3.0;
function Start () {
}
function Update () {
var direction = Vector3.zero;
if(Input.GetKey(KeyCode.A)) {
direction += Vector3.left;
}
if(Input.GetKey(KeyCode.S)) {
direction += Vector3.back;
}
if(Input.GetKey(KeyCode.D)) {
direction += Vector3.right;
}
if(Input.GetKey(KeyCode.W)) {
direction += Vector3.forward;
}
transform.Translate(direction * speed * Time.deltaTime);
}