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

I am very new to c# and all this. I am an absolute beginner and i am stuck at this very simple code. Please help me on how do i increase the speed of the object and how do i get it to jump on pressing spacebar?

$
0
0
public class PlayerController : MonoBehaviour { private Rigidbody rb; void Start () { rb = GetComponent(); } void FixedUpdate () { float movehorizontal = Input.GetAxis("Horizontal"); float movevertical = Input.GetAxis("Vertical"); Vector3 movement = new Vector3(movehorizontal, 0, movevertical); rb.AddForce(movement); } }

Viewing all articles
Browse latest Browse all 1264

Trending Articles



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