I am planning to make a game which includes physics, but I don't know much about it.
What is the angle and velocity of a ball if:
1. It is hitting another bigger ball(which is not moving)?
2. It is inside the outline of a bigger ball and it is about to hit the side?
3. It is hitting the corner of a square?
Offline
You need to calculate the shared tangent, then bounce the ball off of that just like you would bounce it off a line.
Offline
And how would you calculate the shared tangent in Scratch, without actually knowing the co-ordinates or radius of the ball?
Offline
Well then what do you know?
Offline
Hardmath123 wrote:
Well then what do you know?
![]()
Right... suppose you drew the circles with the pen and have to sense everything.
Offline
crazycat3 wrote:
What if for 1 and 2 you know the radius, the speed and the coordinates of both balls?
For 3 you know the coordinates and the speed of both the ball and the corner.
Is it possible to solve it then?
Do you know the math for a ricochet? The tangent is just the direction to the smaller ball +90 degrees. To find the direction between two points do this: https://sites.google.com/site/byobimages/_/rsrc/1338787932996/home/atan2/atan2.jpg
and if you don't know how to find the angle of deflection between two lines here is a solution:
https://sites.google.com/site/byobimages/_/rsrc/1338788588133/home/deflection/deflection.jpg
Offline
BornAgainAtheist wrote:
Do you know the math for a ricochet? The tangent is just the direction to the smaller ball +90 degrees. To find the direction between two points do this: https://sites.google.com/site/byobimages/_/rsrc/1338787932996/home/atan2/atan2.jpg
and if you don't know how to find the angle of deflection between two lines here is a solution:
https://sites.google.com/site/byobimages/_/rsrc/1338788588133/home/deflection/deflection.j
Is it possible to explain it for me or tell what the variables are?
Offline
For the direction finder I used trigonometry to find the direction from point (x,y) to point (dx,dy) it's not important in this case to understand how it works as long as you know how to use it. If you are curious, 'a' and 'b' are the differences between points (x,y) and (dx,dy).
In the case of the deflection function, 'approach' is the direction the object is approaching at and 'wall' is the direction the line being bounced of is pointing.
Offline