Jump to content
  • Advertisement
Sign in to follow this  
rik_GT

Knowing position of object ahead of time

This topic is 2169 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

[color=#323D4F]Hi all

[color=#323D4F]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?

[color=#323D4F]Any idea or explanation on how this could be done is very much appreciated icon_smile.gif

[color=#323D4F]thanks

Share this post


Link to post
Share on other sites
Advertisement
You can isolate the code that does the simulation of how the ball moves and run it forward until it hits the ground. That's probably the best way to do it.

Share this post


Link to post
Share on other sites

You can isolate the code that does the simulation of how the ball moves and run it forward until it hits the ground. That's probably the best way to do it.

That is probably the most computing time intensive way if you do the whole simulation.

The movement of the ball is really simulated through the integration of its position. Usually through a differential equation of second degree (velocity and acceleration). Instead of running the whole simulation you just have to compute to the time step when the Y coordinate becomes 0.

Share this post


Link to post
Share on other sites

[quote name='alvaro' timestamp='1342097376' post='4958380']
You can isolate the code that does the simulation of how the ball moves and run it forward until it hits the ground. That's probably the best way to do it.

That is probably the most computing time intensive way if you do the whole simulation.

The movement of the ball is really simulated through the integration of its position. Usually through a differential equation of second degree (velocity and acceleration). Instead of running the whole simulation you just have to compute to the time step when the Y coordinate becomes 0.
[/quote]

If you have an analytic solution to the differential equation, you can certainly use it. However, once you take effects like drag and spin into account, you are going to have to do it numerically. If you simply run the simulation you can be certain that the result will be correct. If this takes too long (I doubt it, since you are only simulating one object and you don't need to run collision detection or anything of that sort), you can increase the time step and trade accuracy for speed.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!