Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Say I have an object that has a variable mass. Now I want to apply a vertical impulse (straight up into the air) onto the object, so it always flies up to the same height. How do I calculate this?

So the variables are:

m: mass
Y: height (constant)
If: Impulse force
G: Gravity

The origin is always from a floor, so no mid-air impulses or anything.

(I'm using the Box2D engine, but I think that a solution would be engine independent?)

share|improve this question
    
v = I/m; t = Y/v; Done, IIRC. –  PlayDeezGames Mar 5 '12 at 20:13

2 Answers 2

up vote 4 down vote accepted

The potential energy of the object at its apex is m*g*h where g is the acceleration due to gravity, m is the mass of the object, and h is the height you want it to go to. We want the initial kinetic energy, 1/2*m*v^2 to be equal to the final potential energy. So we have

2*m*g*h=m*v^2

Impulse is defined as Force*time, so F*t=m*a*t, but under constant acceleration a*t=v, so we have Impulse=m*v. Solving for v and plugging in we have: 2*g*h=v^2=Impulse^2/m^2

Impulse=Sqrt(2gh)*m.

share|improve this answer

it really depends on how long do you want to apply the force.

but for starter you can use m*g*Y = f*dy in which f is the force you are applying and dy is how far does the object travel before you stop applying the force (which usually is a small value for impulses)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.