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

Rigidbody.Addforce not working in Unity 5.4.1

$
0
0
Hello! In my game, I’m trying to get my player to jump, and in past games it’s worked, but for some reason now it just won’t do anything. I don’t get any errors, but whenever I press space, nothing happens. Why is this happening? Is it the version of Unity I’m using (5.4.1), or what? I tried looking at the script reference, but there's not even an example in Javascript. Here’s my code, if that helps: #pragma strict public var jumpSpeed = 10; function FixedUpdate() { if (Input.GetKey(KeyCode.Space)) { GetComponent.().AddForce(new Vector3(0, jumpSpeed * Time.deltaTime, 0)); } }

Viewing all articles
Browse latest Browse all 1264

Trending Articles



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