- Home /
The faster my character goes the longer he jumps.
Hi I'm making a endless runner/Temple run type game. My only problem so far is that the faster he's going, The longer he jumps(The character speeds up as he gets farther). What can I do about this? Im using rigidbody for Jumping.
Are you using the AddForce method? If so, what parameters are you sending to it?
This is expected behavior from a Physics or $$anonymous$$athematical perspective of course. You have a few options I can see to work around this, each with consequences:
Calculate how much force to apply to always land X meters from the start of a jump - jumps will be lower the faster the player runs
Increase (or supplement) the Gravity force the faster he runs - player will go up and down faster which may look a little odd at really high speeds
Always set the speed to a constant value whilst in the air - player slows down whilst airborne
This is as much a design decision as anything... you may even decide to stick with the current situation after evaluating the options.
Could you give me an example please @Huacanacha
It would be great if you could include some of your code with the question, so we can see exactly what needs to be done.
Just get the velocity of your player by rigidbody.velocity.magnitude and calculate your desired speed at a point and make a if statement. If velocity is greater than your desired speed add a drag to your player or add a counter force. Hope this helps
Answer by Litleck · Sep 14, 2017 at 01:49 AM
Can I see your script for this, I cant get much information from this.