Knowing position of object ahead of time

monk
Posts: 7
Joined: Tue Dec 08, 2009 1:38 pm

Knowing position of object ahead of time

Post by monk »

Hi all

In games Like FIFA or Pro Evo Soccer when the ball is in the air after being kicked, a small cross appears on the pitch marking the position where the ball will fall... How can you find out the position where the ball will fall ahead of time?

Any idea or explanation on how this could be done is very much appreciated :)

thanks
monk
Posts: 7
Joined: Tue Dec 08, 2009 1:38 pm

Re: Knowing position of object ahead of time

Post by monk »

Anyone :( ?
N_K
Posts: 14
Joined: Mon Jun 04, 2012 11:40 pm

Re: Knowing position of object ahead of time

Post by N_K »

My only idea right now is to use two separate dynamics worlds, and step the simulation faster in one of the worlds. This is only theoretical, however, I haven't tried this.
STTrife
Posts: 109
Joined: Tue May 01, 2012 10:42 am

Re: Knowing position of object ahead of time

Post by STTrife »

Depends on what kind of objects you want to predict. A ball in the air is easy, specially if there is no air friction. Then you can use the math that you learned in high school physics class :)
the horizonal speed is linear, the vertical speed has an acceleration downward from gravity. Then you use the formulas for that, make a nice equation. You know the height of the floor, so eventually you want the y position to be the same as the height of the floor and then solve for t (time). if you know t you can also calculate the x and z positions.
anyway this is only for an object in a frictionless air, with a flat floor.

But if gets more complex you cannot solve it, but you have to simulate it I guess. A second physics simulation would be a nice idea indeed. It would be easiest if you could clone the current physics world, and then step the clone world until either you are at the time you want to know, or step until some collision happens that you want to know. I don't know how hard it is to clone the current physics world???

If you tell more exact what it is you want (a ball in the air? or just general look ahead in time?) that would be helpfull.
monk
Posts: 7
Joined: Tue Dec 08, 2009 1:38 pm

Re: Knowing position of object ahead of time

Post by monk »

Thanks for the replies.

The motion of the ball is not fixed as it is affected by other forces also the terrain has highs and lows so i think I really need to point of collision.

How can we have 2 versions of the physics simulation? Wouldn't that be a bit overkill?

Thanks :)
dumbo2007
Posts: 66
Joined: Sun Jan 30, 2011 8:46 pm

Re: Knowing position of object ahead of time

Post by dumbo2007 »

It isnt really that much of a CPU or memory hog...if thats what you are worried about. I think that the only delaying factor may be the possibly large number of sim steps in the 2nd world that you may have to wait for , to complete before your next frame update.
khoowaikeong
Posts: 43
Joined: Fri Jun 15, 2012 7:11 am

Re: Knowing position of object ahead of time

Post by khoowaikeong »

we could timestep the 2nd world and have only 'the ball' and the terrain in it to plot a projected path. of course if we want to simulate interaction with other moving object that might hit it, we will need to clone those stuff as well. however I think the 'path line' in most game are generated by math formula, usually it the same formula use to make the AI aiming system.