new to implementing physics

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

Recommended Posts

Hi,

I'm kind of new to simulating physics, so to start with something I thought of a 2D Pong, but I have no idea how to implement physics. I use my own math library (libmymath.sf.net), I have all the geometry data (vertices, and normal vectors from obj files) in memory I just don't know how to check collisions etc. I can display the whole stuff too.
Can someone point me to some tutorials on this topic, or explain some basic stuff to me?

Thanks,
Yours3!f

Edit: see the screenshot

Share on other sites
There are many great physics libraries out there. I would suggest looking into Havok, PhysX, Box2D, ODE, etc.

Other than that you may want to look at this book on Google to get started.
Physics for Game Programmers

For a simple pong game research bounding boxes and bounding spheres. When you detect a collision you would simply reverse the velocity of the ball to make it "bounce" off of the paddle in the opposite direction. Just Google "Pong Physics" and there will be plenty of resources for you to learn from.

Share on other sites

There are many great physics libraries out there. I would suggest looking into Havok, PhysX, Box2D, ODE, etc.

For a Pong game? It's like using a Ferrari to go to the bus stop. Just check if the ball is in the bounding box of the paddle and switch the direction of the ball velocity vector.

Share on other sites

[quote name='UltimaX' timestamp='1315939441' post='4861201']
There are many great physics libraries out there. I would suggest looking into Havok, PhysX, Box2D, ODE, etc.

For a Pong game? It's like using a Ferrari to go to the bus stop. Just check if the ball is in the bounding box of the paddle and switch the direction of the ball velocity vector.
[/quote]

I was simply making a point that there are already mature physics libraries out there; perhaps you failed to read the rest of my post. I said the exact same thing you just did ("When you detect a collision you would simply reverse the velocity of the ball to make it "bounce" off of the paddle in the opposite direction.").

Also, in his post he said "to start with", which to me means he would like more than just pong. If he stated it was for pong and pong only then I would have left that part out.

Please read someones post in its entire next time before jumping to conclusions.

Share on other sites

[quote name='Dunge' timestamp='1315945061' post='4861240']
[quote name='UltimaX' timestamp='1315939441' post='4861201']
There are many great physics libraries out there. I would suggest looking into Havok, PhysX, Box2D, ODE, etc.

For a Pong game? It's like using a Ferrari to go to the bus stop. Just check if the ball is in the bounding box of the paddle and switch the direction of the ball velocity vector.
[/quote]

I was simply making a point that there are already mature physics libraries out there; perhaps you failed to read the rest of my post. I said the exact same thing you just did ("When you detect a collision you would simply reverse the velocity of the ball to make it "bounce" off of the paddle in the opposite direction.").

Also, in his post he said "to start with", which to me means he would like more than just pong. If he stated it was for pong and pong only then I would have left that part out.

Please read someones post in its entire next time before jumping to conclusions.
[/quote]

Thanks both of you.

Ultimax:
I know these libraries, however I want to do all this manually, but thanks for pointing them out, I will look at the source of them, so I might learn from them. Thanks for the book too, this is exactly what I need. This will probably help me implementing this "bouncing" algorithm.

Dunge:
Yes it's useless to shoot a bird with a cannon, but as Ultimax pointed out, I hope this will be only the beginning, that is I hope to implement a full physics engine (or something like that) in the future. I like to know how the internals work when I work with a library.

So thanks again

Share on other sites
Hi [color=#1C2837][size=2]Yours3!f,
[color=#1C2837][size=2]

[color=#1C2837][size=2]You can check out my article in which I discuss the physics behind pong, among other things!
[color=#1C2837][size=2]

[color="#1c2837"]http://www.wildbunny.co.uk/blog/2011/04/06/physics-engines-for-dummies/
[color="#1c2837"]

[color="#1c2837"]Cheers, Paul.

Share on other sites

Hi [color="#1C2837"]Yours3!f,

[color="#1C2837"]You can check out my article in which I discuss the physics behind pong, among other things!

[color="#1c2837"]http://www.wildbunny...es-for-dummies/

[color="#1c2837"]Cheers, Paul.

I read the one about speculative contacts too, the idea is GREAT!

+ I ordered the book

1. 1
2. 2
3. 3
Rutin
17
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• Forum Statistics

• Total Topics
633660
• Total Posts
3013218
×