Archived

This topic is now archived and is closed to further replies.

Unusual Circle-Circle Collision Response

This topic is 5536 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Share on other sites
Physics is just the way objects interact. You already have your own basic physics system implemented (it just happens to not be exactly like real physics). You don''t need to implement any sort of realistic physics, you can make the objects interact however you like. Now to make the ball travel faster after a hard collision, you''ll want to make the ball''s resulting velocity relate in some way to the ball''s old velocity (if the ball is moving faster, it will bounce off faster) and the paddle''s velocity (a fast paddle will make the ball go faster). You''ll want to calculate the paddle''s speed relative to the ball, to determine if the collision will slow down or speed up the ball. You might also want a minimum and maximum speed limit, to keep the game under control.

Share on other sites
to push the ball to the end of the other ball simply move it in the direction of the line connecting the two centers so that the distance between the two centers is 2*radius.

Share on other sites
Hi guys,

Thanks for the help.

I tried a few things and it still isn''t right. Here is what''s happening:

The moving paddle hits the ball causing a collision, I set the ball and paddle to their respective positions at the time of the collision (so they just touch) and set the ball''s new direction; then the frame gets rendered and goes back into the collision detection/move objects function.

But since the paddle was still moving (because the user was still moving the mouse between frames) it hits the ball again before the ball gets away in it''s new direction.

A pretty fast ball moves at 1,000 pixels per second, 2,000 is really fast, almost ridiculously so. However, the paddle can move at 8,000 pixels per second (I capped it at that, anything slower is not responsive.) So the ball has to move away from the paddle faster than that after it gets hit to prevent it from "sticking."

I tried giving the ball a boost for one second after it got hit and so far that''s my best solution but it doesn''t feel right.

Any ideas ?

Thanks.

Share on other sites
quote:
Hi guys,

Thanks for the help.

I tried a few things and it still isn''t right. Here is what''s happening:

The moving paddle hits the ball causing a collision, I set the ball and paddle to their respective positions at the time of the collision (so they just touch) and set the ball''s new direction; then the frame gets rendered and goes back into the collision detection/move objects function.

But since the paddle was still moving (because the user was still moving the mouse between frames) it hits the ball again before the ball gets away in it''s new direction.

A pretty fast ball moves at 1,000 pixels per second, 2,000 is really fast, almost ridiculously so. However, the paddle can move at 8,000 pixels per second (I capped it at that, anything slower is not responsive.) So the ball has to move away from the paddle faster than that after it gets hit to prevent it from "sticking."

I tried giving the ball a boost for one second after it got hit and so far that''s my best solution but it doesn''t feel right.

Any ideas ?

Thanks.

ball again before the ball gets away in it''s new direction.

Let''s call that direction bv. This could be represented by a vector. The paddle should also have a velocity vector, pv. After you find out bv (making it bounce), just do bv+=pv. That way, the paddle''s momentum is transferred to the ball, just like in real life. That way, the faster you move the paddle, the faster the ball will move.

That''s how I''m gonna do it in my air hockey game.

1. 1
2. 2
3. 3
4. 4
Rutin
12
5. 5

• 12
• 16
• 10
• 14
• 10
• Forum Statistics

• Total Topics
632659
• Total Posts
3007691
• Who's Online (See full list)

There are no registered users currently online

×