Track the ball's path

Good afternoon!
How can you track the path of a soccer ball that has received an instantaneous impulse, and during the movement on the field had several collisions with the walls of the field and other balls, after which the trajectories were changed?

You’d need to explain a little more clearly what you mean by tracking the ball’s path. If you just need to know it’s positions over a period of time, you can call a function as often as you need to track the position (or call it each frame, if you are using some kind of an update routine) and get the x,y coordinates of the sprite of the ball and put them into a table like a queue.

You can further use values from this table to assign positions to pre-instantiated display objects, in case you are trying to go for a trail effect or similar.

1 Like

Yes, you need to know all the coordinates of the ball, even after a collision with other objects.
It is necessary to check whether the trajectory of the ball intersects with the line of restriction of movement.