Nemox
1
I’m trying to make my character jump to a certain height using only a single impulse.
The only values I have available are Gravity and desired Height. (Using VelocityChange, so mass is irrelevant.)
What is my feeble brain missing to solve for velocity necessary?
Physics! I love physics.
maxHeight = (initialVelocity^2) / (2g)
Use that formula… in fact, if you solve for initialVelocity, you can make a “jump to height” line. In javascript:
var jumpHeight;
if(Input.GetButtonDown("Jump")){
transform.velocity.y = Mathf.Sqrt(jumpHeight * -2 * physics.gravity.y);
}