Quantcast
Channel: Questions in topic: "issue"
Viewing all articles
Browse latest Browse all 827

How to make a proper double jump - rigidbody

$
0
0
I'm trying to make my double jump work consistently every time you jump.. The problem I'm having is that because of gravity, velocity.y is greater as soon as you jump than it is right before you land, and the same goes for when the character is at its zenith for example, if jumpSpeed is 600, when I apply Addforce(0,jumpSpeed,0); to the beginning of the jump, the characters velocity is say 50, so if you do the double jump very fast, the character goes way high if you do the double jump right before the character touches the ground, its like nothing happens, because velocity.y is a negative value I tried to add currentYVelocity = rigidbody.velocity.y rigidbody.Addforce(0,-currentYVelocity,0) to Addforce right before I apply the new rigidbody.addforce(0,jumpSpeed,0), but this doesn't seem to do anything I imagine there is some complicated maths that need to be done? or perhaps something in c# that already takes care of this? Thanks for any help

Viewing all articles
Browse latest Browse all 827

Trending Articles



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