#Predict Ball Movement

1 messages · Page 1 of 1 (latest)

hushed shore
brazen cove
#

Just to get you started, you can imagine that when the tennis ball goes downwards the tennis court is mirrored below the real court and the ball goes through the mirror. The Y coordinate of where it hits the right side is the negative of the actual Y coordinate in the real court. This is assuming that the bottom of the tennis court is at Y = 0

#

If the ball bounces multiple times, even number of bounces are not mirrored but they're at (Y coordinate % height of court)

#

(the examples have the height as 20)

#

If the ball starts by going upwards it's similar logic, you just have to subtract the height

hushed shore
#

ahhh thats really clever, thx!

brazen cove
#

I just realized that in the second picture the mirror ball hits at y = -32 instead so the calculation is wrong but 20 + (-32 % 20) gives the correct answer

#

Another option that requires less maths is to do a raycast to where the ball is going, if it hits a border get the reflection and do another raycast with the reflection, and continue until it hits the back wall. This works only if the borders are made with colliders