This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2010-09-02 13:25:49

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Pong Physics

In real life, would the paddle's position affect the pong ball's movement/location? Like, would it affect the location/movement of the ball if I hit the ball directly in the center of the paddle rather than near the end of the paddle? If so, how could I program this change into Scratch?

Last edited by Sunrise-Moon (2010-09-02 13:26:07)


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#2 2010-09-02 13:27:41

Greentabby55
Scratcher
Registered: 2010-05-04
Posts: 50

Re: Pong Physics

It depends if the paddle is straight or not.

Offline

 

#3 2010-09-02 13:31:20

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Pong Physics

Greentabby55 wrote:

It depends if the paddle is straight or not.

Eh?


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#4 2010-09-02 13:58:51

Greentabby55
Scratcher
Registered: 2010-05-04
Posts: 50

Re: Pong Physics

Is the paddle tilted?

Offline

 

#5 2010-09-02 14:06:43

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Pong Physics

Greentabby55 wrote:

Is the paddle tilted?

No.


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#6 2010-09-02 15:40:08

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Pong Physics

Sunrise-Moon wrote:

Greentabby55 wrote:

Is the paddle tilted?

No.

Then, in real life, the postition of the paddle relative to the ball wouldn't change the ball's course. However, if it is curved or tilted, it will.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#7 2010-09-02 15:57:01

colorfusion
Scratcher
Registered: 2009-10-03
Posts: 500+

Re: Pong Physics

Not unless it was curved/Tilted (Or hit on the edge)
But on most pong games it makes it bounce more to the side you hit it with just to give you more control.

Offline

 

#8 2010-09-02 16:24:56

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Pong Physics

colorfusion wrote:

Not unless it was curved/Tilted (Or hit on the edge)
But on most pong games it makes it bounce more to the side you hit it with just to give you more control.

Ohk. I'm not sure how I'd do that...


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#9 2010-09-02 17:00:23

scmb1
Scratch Team
Registered: 2009-03-19
Posts: 1000+

Re: Pong Physics

Well, if the paddle is moving, that would affect the ball's movement.


http://i48.tinypic.com/2z5pqad.png

Offline

 

#10 2010-09-02 17:31:36

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Pong Physics

scmb1 wrote:

Well, if the paddle is moving, that would affect the ball's movement.

You sure?


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#11 2010-09-02 17:43:16

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Pong Physics

scmb1 wrote:

Well, if the paddle is moving, that would affect the ball's movement.

Depends on the friction.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#12 2010-09-02 18:56:01

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Pong Physics

You could have the angle of the bounce adjusted based on its position relative to the paddle's. For example [point in direction ((180 - direction) + (position - x position of paddle))], or something like that. That script probably won't work exactly right, but you get the idea.

Last edited by Harakou (2010-09-02 19:44:01)


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#13 2010-09-02 19:26:43

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Pong Physics

Harakou wrote:

You could have the angle of the bounce adjusted based on its position relative to the paddle's. For example [point in direction ((direction * -1) + (position - x position of paddle))], or something like that. That script probably won't work exactly right, but you get the idea.

Actually, I'm using false velocity/a directional variable, so that probably won't work.


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#14 2010-09-02 19:27:22

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Pong Physics

Harakou wrote:

You could have the angle of the bounce adjusted based on its position relative to the paddle's. For example [point in direction ((direction * -1) + (position - x position of paddle))], or something like that. That script probably won't work exactly right, but you get the idea.

Correction: [point in direction ( ( (direction) + ( (x position) of paddle) ) * -1)]

Last edited by ScratchReallyROCKS (2010-09-02 19:28:07)


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#15 2010-09-02 19:44:57

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Pong Physics

ScratchReallyROCKS wrote:

Harakou wrote:

You could have the angle of the bounce adjusted based on its position relative to the paddle's. For example [point in direction ((direction * -1) + (position - x position of paddle))], or something like that. That script probably won't work exactly right, but you get the idea.

Correction: [point in direction ( ( (direction) + ( (x position) of paddle) ) * -1)]

You forgot the x position of the ball.


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#16 2010-09-02 20:09:51

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Pong Physics

Harakou wrote:

ScratchReallyROCKS wrote:

Harakou wrote:

You could have the angle of the bounce adjusted based on its position relative to the paddle's. For example [point in direction ((direction * -1) + (position - x position of paddle))], or something like that. That script probably won't work exactly right, but you get the idea.

Correction: [point in direction ( ( (direction) + ( (x position) of paddle) ) * -1)]

You forgot the x position of the ball.

*facepalm* I feel stupid  tongue


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#17 2010-09-02 20:34:18

scmb1
Scratch Team
Registered: 2009-03-19
Posts: 1000+

Re: Pong Physics

ScratchReallyROCKS wrote:

scmb1 wrote:

Well, if the paddle is moving, that would affect the ball's movement.

Depends on the friction.

Of course, but with a "real life" paddle, it would affect it. But don't listen to me too much. I'm no physics expert. (Haven't even taken Physics yet.)


http://i48.tinypic.com/2z5pqad.png

Offline

 

#18 2010-09-02 20:41:30

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Pong Physics

scmb1 wrote:

ScratchReallyROCKS wrote:

scmb1 wrote:

Well, if the paddle is moving, that would affect the ball's movement.

Depends on the friction.

Of course, but with a "real life" paddle, it would affect it. But don't listen to me too much. I'm no physics expert. (Haven't even taken Physics yet.)

If the friction and mass were right, the movement of the paddle probably would affect the movement a bit. I don't think it's significant enough to worry about unless you want to make the game have really nice physics.


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#19 2010-09-03 00:49:39

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: Pong Physics

Harakou wrote:

You could have the angle of the bounce adjusted based on its position relative to the paddle's. For example [point in direction ((direction * -1) + (position - x position of paddle))], or something like that. That script probably won't work exactly right, but you get the idea.

Sunrise-Moon wrote:

Actually, I'm using false velocity/a directional variable, so that probably won't work.

Sure it will. You have to use the directional variable to figure top and side bounces. And the X values are X values regardless of what kind of velocity/movement function you use.

My pong does this except it is horizontal so it uses Y values instead of X.

Locomule's Basic Pong


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#20 2010-09-03 19:55:04

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Pong Physics

Sunrise-Moon wrote:

Harakou wrote:

You could have the angle of the bounce adjusted based on its position relative to the paddle's. For example [point in direction ((direction * -1) + (position - x position of paddle))], or something like that. That script probably won't work exactly right, but you get the idea.

Actually, I'm using false velocity/a directional variable, so that probably won't work.

Well then that actually makes it much easier! Just reverse the directional variable. For example, if the paddle is on the bottom and the ball hits it, just multiply the y velocity by -1. And if you want, you could change the x velocity a bit based on the paddle's location/movement.

Last edited by Harakou (2010-09-03 19:55:37)


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#21 2010-09-03 21:18:28

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Pong Physics

Harakou wrote:

Sunrise-Moon wrote:

Harakou wrote:

You could have the angle of the bounce adjusted based on its position relative to the paddle's. For example [point in direction ((direction * -1) + (position - x position of paddle))], or something like that. That script probably won't work exactly right, but you get the idea.

Actually, I'm using false velocity/a directional variable, so that probably won't work.

Well then that actually makes it much easier! Just reverse the directional variable. For example, if the paddle is on the bottom and the ball hits it, just multiply the y velocity by -1. And if you want, you could change the x velocity a bit based on the paddle's location/movement.

xD I was already doing the first part  tongue . I'll try the second part though  smile


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#22 2010-09-03 22:57:48

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Pong Physics

Simply adding the velocity of the paddle to that of te paddle will give you a realistic (but not completely perfect) physical illusion.

Offline

 

#23 2010-09-03 23:01:58

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Pong Physics

coolstuff wrote:

Simply adding the velocity of the paddle to that of te paddle will give you a realistic (but not completely perfect) physical illusion.

QFP.


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#24 2010-09-03 23:10:27

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Pong Physics

Sunrise-Moon wrote:

coolstuff wrote:

Simply adding the velocity of the paddle to that of te paddle will give you a realistic (but not completely perfect) physical illusion.

QFP.

Pardon me? I'm familiar with "QFT" but I'm afraid that is a new term for me...

Offline

 

#25 2010-09-03 23:43:46

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Pong Physics

coolstuff wrote:

Sunrise-Moon wrote:

coolstuff wrote:

Simply adding the velocity of the paddle to that of te paddle will give you a realistic (but not completely perfect) physical illusion.

QFP.

Pardon me? I'm familiar with "QFT" but I'm afraid that is a new term for me...

Quoted for Proof xP. You miswrote that post. Thanks for the help though  smile . I guess I could make the x velocity slowly go down after touching the paddle  smile


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

Board footer