Jump to content
• Advertisement

# Knowing position of object ahead of time

This topic is 2348 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

[color=#323D4F]thanks

#### Share this 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

##### 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

##### 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

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
Rutin
21
3. 3
4. 4
A4L
15
5. 5
khawk
14
• Advertisement

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633742
• Total Posts
3013636
×

## Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!