Question by
muxe666 · Jan 12, 2017 at 03:47 PM ·
c#rotationcharactercharactercontrollerrotate object
Character Rotation
Hey there! I am really new in C# and I'm really Proud that my character is moving. But I need help by Rotating my 2D sprite(my character) in the direction he is moving.
Here is my wonderful code: using UnityEngine; using System.Collections;
public class Astroneer : MonoBehaviour {
float speed = 5f;
void Update () {
transform.Translate( new Vector3 (
Input.GetAxis ("Horizontal") * speed,
Input.GetAxis ("Vertical") * speed,
0) * Time.deltaTime );
}
}
Thanks for help!
Comment
i have never worked with sprites, or 2D but if you can get the axis that the character needs to turn you can program it in.
e.g. Y= 90 Y= -90
something like that?