physics of bouncing balls
i am messing with some physics junk, and i have a ball bouncing around in a box (with gravity and mass). Over time, the ball''s bounce gets smaller and smaller like in real life.
But my question is, how do you determine of a ball will bounce or just roll down an incline?
Right now it is just bouncing and bouncing until it reaches a standstill and sits there on the incline (when it should be rolling down it).
--------------------------------------------------------------If it sounds like a good idea, do it. It is much harder to get permission than it is to apologize.
When a ball bounces in an incline, its velocity vector is affected by the direction of the incline.
If you use it this way, there will be a time that the "bouncing" effect will be so small that the ball appears to be only rolling down the hill.
This is just an opinion!! I''m trying to learn something how of this too!
If you use it this way, there will be a time that the "bouncing" effect will be so small that the ball appears to be only rolling down the hill.
This is just an opinion!! I''m trying to learn something how of this too!
youd think it would work that way :-P
but in my program, the bounce keeps getting smaller and smaller so it is going at a very slow and unrealistic rate down the incline...
but in my program, the bounce keeps getting smaller and smaller so it is going at a very slow and unrealistic rate down the incline...
--------------------------------------------------------------If it sounds like a good idea, do it. It is much harder to get permission than it is to apologize.
Are you using vectors to calculate velocity and acceleration?
If so, there will be a time that when the ball hits the surface, the new calculated velocity vector will simply point down the incline.
Just trying to remember my physics classes
Note: I'm not getting any mail notifications from the board when someone replies to topics registered as bookmarks!
Changing my original hotmail address to my "official" one didn't help. Is it only me or the bookmark feature is simply broken?
Well, just checked again and it seems the bookmark feature is for bookmarking (what a surprise!
). It'd be nice to have mail notification too though.
[edited by - t0y on March 31, 2002 4:13:08 PM]
If so, there will be a time that when the ball hits the surface, the new calculated velocity vector will simply point down the incline.
Just trying to remember my physics classes

Note: I'm not getting any mail notifications from the board when someone replies to topics registered as bookmarks!
Changing my original hotmail address to my "official" one didn't help. Is it only me or the bookmark feature is simply broken?
Well, just checked again and it seems the bookmark feature is for bookmarking (what a surprise!

[edited by - t0y on March 31, 2002 4:13:08 PM]
Yes i am using vectors. But the way you propose will always cause the ball to roll down the incline. It will never bounce.
--------------------------------------------------------------If it sounds like a good idea, do it. It is much harder to get permission than it is to apologize.
some ideas:
yes, adjust the direction part of the vector so that it has some horizontal movement. The ball should not have a direction straight down, but parallel to the slope. Also gravity continues acting on the ball, so it should speed up as it rolls.
or maybe you could have 2 states: BOUNCING, ROLLING
figure out whats best for you app.
Note: this is different from the collision detection of a player with a wall (no bounce). In this case the direction vector does not change(you are still trying to move in the direction you are facing), however is "adjusted."
yes, adjust the direction part of the vector so that it has some horizontal movement. The ball should not have a direction straight down, but parallel to the slope. Also gravity continues acting on the ball, so it should speed up as it rolls.
or maybe you could have 2 states: BOUNCING, ROLLING
figure out whats best for you app.
Note: this is different from the collision detection of a player with a wall (no bounce). In this case the direction vector does not change(you are still trying to move in the direction you are facing), however is "adjusted."
it's all about a good time!AOLIM name: -LOKAPUJA-
Dunno if you've seen this, but in case not...
There was a nice gamasutra article a while ago called
Pool hall lessons, could be useful..
Cheers
[edited by - llyod on March 31, 2002 11:07:05 PM]
March 31, 2002 10:45 PM
RPGman,
Physics-wise, if the ball is bouncing on any surface, it''s easiest if your math is in a coordinate frame that''s level with the surface. That is, let''s assume that X'' is level with the surface and Y'' is perpendicular to it. X and Y are the world frame axis.
1. Rotate the velocity vector [vx,vy] from world into [vx'',vy''].
2. Your new post-bounce vector is [vx'',-a*vy''], where a is the bounce factor.
3. Rotate that back into world coorinates.
So as most have already pointed out, as -a*vy'' becomes really small, it''ll seem like the ball is rolling down the incline. If you want to avoid some of the costly collision detection, you can snap the vy'' to zero if it''s close enough and then apply only the gx'' component of gravity to let it roll down the incline. That is, assuming the incline is flat.
TLC
Physics-wise, if the ball is bouncing on any surface, it''s easiest if your math is in a coordinate frame that''s level with the surface. That is, let''s assume that X'' is level with the surface and Y'' is perpendicular to it. X and Y are the world frame axis.
1. Rotate the velocity vector [vx,vy] from world into [vx'',vy''].
2. Your new post-bounce vector is [vx'',-a*vy''], where a is the bounce factor.
3. Rotate that back into world coorinates.
So as most have already pointed out, as -a*vy'' becomes really small, it''ll seem like the ball is rolling down the incline. If you want to avoid some of the costly collision detection, you can snap the vy'' to zero if it''s close enough and then apply only the gx'' component of gravity to let it roll down the incline. That is, assuming the incline is flat.
TLC
v = v-(n*( v dot n ) )*2
v = velocity
n = normal
u might wanna rescale it to advoid a perfect bounce
http://uk.geocities.com/sloppyturds/gotterdammerung.html
v = velocity
n = normal
u might wanna rescale it to advoid a perfect bounce
http://uk.geocities.com/sloppyturds/gotterdammerung.html
Thanks for the help everyone, but I got it to work thanks to cedricl. When the ball hit the surface, I needed to subtract the mass from the velocity in the direction of the plane''s normal. It works great now but thanks for all the replies!
--------------------------------------------------------------If it sounds like a good idea, do it. It is much harder to get permission than it is to apologize.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement