Question by
IntelDev94 · Mar 08, 2016 at 09:10 AM ·
c#transform3dtransform.translate
3D Player Controller Movement won't face it's head in the direction of the arrow key press
My character moves with the controllers using arrow key presses. I am trying to have my player which is an insect turn its body head-first in the direction of the arrow key.
Thanks for any help.
Here is the script I'm using to control the character:
using UnityEngine;
using System.Collections;
public class player : MonoBehaviour {
public float moveSpeed;
//private Rigidbody rbody;
// Use this for initialization
void Start ()
{
moveSpeed = 2f;
//rbody = GetComponent<Rigidbody> ();
}
// Update is called once per frame
void Update ()
{
//print (Input.GetAxis("Horizontal"));
transform.Translate ( moveSpeed * Input.GetAxis("Horizontal") * Time.deltaTime,0f, moveSpeed * Input.GetAxis("Vertical") * Time.deltaTime);
//rbody.AddForce (moveSpeed * Input.GetAxis("Horizontal") * Time.deltaTime,0f, moveSpeed * Input.GetAxis("Vertical") * Time.deltaTime);
}
}
Comment