{
public float moveSpeed;
public float rotSpeed;
public Animator anim;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetKey(KeyCode.W))
{
gameObject.transform.Translate(-moveSpeed * Time.deltaTime, 0, 0);
anim.SetTrigger("WalkForward");
}
if (!Input.GetKey(KeyCode.W))
{
gameObject.transform.Translate(0, 0, 0);
anim.SetTrigger("Stop");
}
if (Input.GetKey(KeyCode.A))
{
//gameObject.transform.Rotate(Vector3.up, -rotSpeed * Time.deltaTime);
gameObject.transform.Rotate(0, 0, rotSpeed * Time.deltaTime);
print("turn");
}
if (!Input.GetKey(KeyCode.A))
{
gameObject.transform.Rotate(0, 0, 0);
}
}
}
I have use Transform.Rotate countless times in the past and for some reason here it will not work. I have tried going through forums and videos making a dozen tiny tweaks and none of them work. So what am I doing wrong?