Quantcast
Channel: Questions in topic: "addforce"
Viewing all articles
Browse latest Browse all 1264

Continuous movement with AddForce.

$
0
0
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? }

Viewing all articles
Browse latest Browse all 1264

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>