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

Jumping with Rigidbody.AddForce not working?

$
0
0
I sort of have two questions here. I'm trying to move my 2d player using velocity instead of transform.position, and so I switched my old one-line movement code to this: rb.velocity = new Vector3(Input.GetAxis("Horizontal"), 0, 0) * moveSpeed * Time.deltaTime; When I did this, suddenly my old jump script using Ridgidbody.AddForce went from being a smooth jump to sort of teleporting the player up into the air. rb.AddForce(transform.up * jumpForce, ForceMode2D.Impulse); I think it has something to do with the the y value I'm setting to 0 constantly in the first line, but any help would be appreciated.

Viewing all articles
Browse latest Browse all 1264

Trending Articles



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