I'm trying to make a character jump on a landing pad who stays above him. Here is the formula I've used (everything is pretty much self-explainable, maybe except character_MaxForce that is the total force the character can jump):

deltaPosition = target - character_position;
sqrtTerm = Sqrt(2 * -gravity.y * deltaPosition.y + MaxYVelocity * character_MaxForce);
time = (MaxYVelocity - sqrtTerm) / gravity.y;
speedSq = jumpVelocity.x * jumpVelocity.x + jumpVelocity.z * jumpVelocity.z;


If speedSq < (character_MaxForce * character_MaxForce) we have the right time so we can store the value:

jumpVelocity.x = deltaPosition.x / time;
jumpVelocity.z = deltaPosition.z / time;


Otherwise we try the other solution:

time = (MaxYVelocity + sqrtTerm) / gravity.y;


and then store it:

jumpVelocity.x = deltaPosition.x / time;
jumpVelocity.z = deltaPosition.z / time;
jumpVelocity.y = MaxYVelocity;

rigidbody_velocity = jumpVelocity;


The problem is that the character is jumping away from the landing pad or sometime he jumps too far never hitting the landing pad.

• You know whether the landing path is left or right by comparing the "x" value. Or you could simply calculate a default trajectory between the two pads. But if you don't want to couple the jump and landing pads then you could simply specify a direction vector in your jump pad and a scalar ( a multiplier ) that acts as a velocity to your character making him jump in a certain direction. Tweaking the scalar and riection should give you the right trajectory. Sep 26 '12 at 23:17
• And by default trajectory I mean using a Quadratic Bezier curve. You know the starting point(jump pad) and the end point(landing pad). Using the control point, which can never be lower than the highest pad, to define your "curve". en.wikipedia.org/wiki/B%C3%A9zier_curve Look at the quadratic formula, it's very simple. ( this will only give you the curve though) Using "t" to trace the curve (which is between 0 an 1 ) Sep 26 '12 at 23:23
• Man I love the game dev because they have always a simple but smart solution thanks a lot man, I will try to implement this and let you now :D Sep 27 '12 at 8:50
• @Sidar you should post all this as an answer. Nov 26 '12 at 9:26
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.626966655254364, "perplexity": 1940.219269133947}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-05/segments/1642320300805.79/warc/CC-MAIN-20220118062411-20220118092411-00199.warc.gz"}