Question by
ChrisVerde02 · Jul 22, 2020 at 08:39 AM ·
wasd
when I press a or d in wasd it does not go either right or left. What is wrong?,I cannot move right or left when using a or d with wasd. Please tell what is wrong
using UnityEngine;
public class movement : MonoBehaviour { public Rigidbody rb;
public float forwardForce = 2000f;
public float sidewaysForce = 500f;
// Start is called before the first frame update
void FixedUpdate()
{
rb.AddForce(0, 0, forwardForce * Time.deltaTime);
if (Input.GetKey("d"));
{
rb.AddForce(sidewaysForce * Time.deltaTime, 0, 0);
}
if (Input.GetKey("a"));
{
rb.AddForce(-sidewaysForce * Time.deltaTime, 0, 0);
}
}
}
Comment