2 Comments
Jun 3, 2022Liked by Massimo Gauthier

I really enjoyed this post! I think I have a direct solution to solve for gravity. Sorry, I didn't bother to make it pretty.

So basically, we have this, which was obtained by plugging in the expression for _timeToApex into the expression for _currentJumpTime:

_currentJumpTime = sqrt(2*_jumpDistance/layerJumpGrav) + sqrt(2*_fallDistance/layerJumpGrav);

In the loop, we want to get _currentJumpTime to equal layerJumpTime (which is known), so replace _currentJumpTime with layerJumpTime, noting that _jumpDistance and _fallDistance are already known:

layerJumpTime = sqrt(2*_jumpDistance/layerJumpGrav) + sqrt(2*_fallDistance/layerJumpGrav);

Factor out sqrt(1/layerJumpGrav):

layerJumpTime = sqrt(1/layerJumpGrav)*(sqrt(2*_jumpDistance) + sqrt(2*_fallDistance));

Muliply both sides by sqrt(layerJumpGrav):

layerJumpTime*sqrt(layerJumpGrav) = sqrt(2*_jumpDistance) + sqrt(2*_fallDistance);

Divide both sides by layerJumpTime:

sqrt(layerJumpGrav) = (sqrt(2*_jumpDistance) + sqrt(2*_fallDistance))/layerJumpTime;

square both sides:

layerJumpGrav = ((sqrt(2*_jumpDistance) + sqrt(2*_fallDistance))/layerJumpTime)^2;

Now, once you have layerJumpGrav, you can find layerJumpVerticalSpeed and _timeToApex

Expand full comment