Discuss Scratch

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?
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/
CoolDevDev
Scratcher
76 posts

Bounce Angle

Try 180-direction
jaofoody1
Scratcher
66 posts

Bounce Angle

CoolDevDev wrote:

Try 180-direction
turning 180 degrees would not work as it would bounce back the way it came and that is not how reflection works
KRAZYKING1010
Scratcher
92 posts

Bounce Angle

I think you subtract 45 from the angle it came from
Spentine
Scratcher
1000+ posts

Bounce Angle

point in direction (() - (direction))
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)

Powered by DjangoBB