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.

I have a ball which I kick with some force. It has a starting x,y position, sat (2,3) and an intended target x,y say (7,8) position. That means I have to translate by (7-2, 8-3) i.e. 5 x units and 5 y units to reach destination.

The things acting on this ball are

force of kick(in direction of target), gravitational pull towards floor due to mass, and friction force provided by grass.

I will experiment different values of the 3 and see which one best simulates. But how do I calculate time required to destination and how much to translate in every frame of my game?

Can anybody please give me an equation for displacement due to these 3 factors and how velocity and other factors required in the equation change with time elapsed?

share|improve this question
2  
hyperphysics.phy-astr.gsu.edu/hbase/hph.html#mechcon This is a general physics question. If you write out the kinematic equations (set of few linear/quadratic equations) for this you should be able to easily transfer them into code. –  mobo Aug 1 '13 at 5:37
    
I would also look at linear algebra. If you want to make/use a physic engine you need to use it. blog.wolfire.com/2009/07/… –  mobo Aug 1 '13 at 6:26
    
You could include air resistance / aerodynamics for the most real result. –  Thomas Aug 1 '13 at 15:20
    
how to do that? –  user494461 Aug 1 '13 at 16:21

1 Answer 1

The ball has a kinetic energy of: enter image description here when kicked.

The force pushing the ball down to the ground can be ignored, since a ball is round, it rolls (doesn't slide), so there's no static friction.

The force of the grass cannot be ignored. And, in this case, essentially acts like static friction, like a block sliding on the ground would encounter friction from the floor, a ball rolling on the grass encounters friction from the grass. We want to know how far the ball will go. Which means we want to know when the kinetic energy of the ball is zero. We want the amount of work done to negate the kinetic energy of the ball we found in the first equation (so we set our equation equal to the negated amount and solve). The amount of work done by friction to stop the ball can be found with:

enter image description here

Solving for distance gives us:

enter image description here

Now that you have the distance, the time can be found with this answer.

However, there are a few options for simulating the movement of the ball in game. One of them could easily lead to you not getting the distance defined by the formula above.

If you're simulating the physics with an iterative approach, your final result will be different (unless your time step is crazy small, you'll have large enough errors to notice). This is similar to the differences you'd get in a Riemann sum estimation vs integration.

An iterative approach is very common in games. But if you're looking for accuracy, you can use the physics equations above and calculate the position of the ball based on the time since the simulation started. The equations for calculating the position since the start of the simulation can be the equations for constant linear acceleration. Since the forces acting on the ball are constant throughout (friction of the grass).

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.