Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Bounce Angle
- han614698
-
Scratcher
1000+ posts
Bounce Angle
How would you make a ball bounce similarly to how it shown in this picture?

Using the “turn 180 cw block” is rather bland as is literally bounces right back where it came from.
How could I calculate the bounce physics for this?

Using the “turn 180 cw block” is rather bland as is literally bounces right back where it came from.
How could I calculate the bounce physics for this?
- Scratch-Minion
-
Scratcher
1000+ posts
Bounce Angle
It depends whether you hit a horizontal or vertical wall.
If the ball hits a vertical wall (left or right wall) as in your picture then
Rebound Direction = Approach Direction * -1
If the ball hits a horizontal wall (top or bottom wall) then
Rebound Direction = 180 - Approach Direction
Example project: https://scratch.mit.edu/projects/138052902/
If the ball hits a vertical wall (left or right wall) as in your picture then
Rebound Direction = Approach Direction * -1
If the ball hits a horizontal wall (top or bottom wall) then
Rebound Direction = 180 - Approach Direction
Example project: https://scratch.mit.edu/projects/138052902/
- jaofoody1
-
Scratcher
66 posts
Bounce Angle
Try 180-directionturning 180 degrees would not work as it would bounce back the way it came and that is not how reflection works
- ROBOTICscratch747
-
Scratcher
34 posts
Bounce Angle
when green flag clicked
forever
if <touching [wall v] ?> then
point in direction ((0) - (direction))
end
end
This script works in bounce off edge.
More tags : #NegativeNumbers #DirectionPhysics
Last edited by ROBOTICscratch747 (March 14, 2022 14:02:34)
- Discussion Forums
- » Help with Scripts
-
» Bounce Angle