I am attempting to move a cube continuously on screen. I have put up my code and I just don't know why it is not updating through each frame. Thank you!
void Start () {
_moveDirection = Vector3.back; // start moving backwards
}
void Update () {
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
_input = new Vector3(moveHorizontal, 0f, moveVertical);
if(_input != Vector3.zero)
_moveDirection = _input;
rigidbody.AddForce(_moveDirection * _moveSpeed); //WHY IS THIS NOT HAPPENING CONTINUOUSLY?
}
↧