Does anyone know of any good physics websites/tutorials?

Started by Ryan Timothy B, Sat 31/01/2009 19:16:59

Previous topic - Next topic

Ryan Timothy B

I've been playing quite a few physics games lately and have been really keen and curious to see if I could attempt to program my own basic physics game.  Whether it's for AGS or another programming language is unknown at this moment.  But here is a little demonstration of what I'd like to attempt:



Collision detection, and angle of collision is something I believe I could do, it's just the whole weight+velocity+gravity+rotation.  I imagine you'd need to find the center of gravity for the object and apply that to the collision, and using the velocity of the object, you determine what angle and where the object will now go.


Does anyone know of any good websites or tutorials that will help explain to me how to apply physics to two connected weights.  I've done some google searching, but with my limited knowledge on what 'equations' this would be called, I figured It'd be better if I just asked.


Remember: The weights are connected by a solid rod (which wouldn't be affected by collision and wouldn't stretch or shrink.  At least not on my first attempt).  Also no air resistance, just to make things easier.

Thanks.

bicilotti

Quote from: Ryan Timothy on Sat 31/01/2009 19:16:59
I've been playing quite a few physics games lately and have been really keen and curious to see if I could attempt to program my own basic physics game.  Whether it's for AGS or another programming language is unknown at this moment.  But here is a little demonstration of what I'd like to attempt:



Collision detection, and angle of collision is something I believe I could do, it's just the whole weight+velocity+gravity+rotation.  I imagine you'd need to find the center of gravity for the object and apply that to the collision, and using the velocity of the object, you determine what angle and where the object will now go.


Does anyone know of any good websites or tutorials that will help explain to me how to apply physics to two connected weights.  I've done some google searching, but with my limited knowledge on what 'equations' this would be called, I figured It'd be better if I just asked.


Remember: The weights are connected by a solid rod (which wouldn't be affected by collision and wouldn't stretch or shrink.  At least not on my first attempt).  Also no air resistance, just to make things easier.

Thanks.

Colourbind, a Shindigger like me (and third place like ColourWise :P) did something very similar to your idea.

Ode is quite reliable, even though implementing physics in a game with it can be a bit cluncky (but that's because I'm a procedural-type guy).

Let me know if you found it useful!

Ghost

The Irrlicht Engine has some rather nifty code for such "basic physics", and since it's open source you may find what you need in there...

Ryan Timothy B

Quote from: bicilotti on Sat 31/01/2009 20:54:38
Colourbind

Ode

Thanks Bic, I'll check out Colourbind (since I have this new interest for physics games lately).  I'll also look into Ode.


Quote from: Ghost on Sat 31/01/2009 22:37:27
Irrlicht Engine

Thanks Ghost, open source sounds excellent.  I'll definitely check that out.  Although the worst thing about using 'code' is that it makes it harder to understand what exactly it's doing and how to modify it.


So I'm still on the hunt for some nice simplified physics equations or what-not if anyone happens to know of any.

Ryan Timothy B

Ooo, an old friend from school showed me this website.  Looks pretty interesting.

Incase anyone else is interested..

I'm still looking/asking around for more equations.

Wonkyth

I think Radiant tried recreating The Incredible Machine with AGS...
"But with a ninja on your face, you live longer!"

Ryan Timothy B

Quote from: wonkyth on Mon 02/02/2009 09:39:13
I think Radiant tried recreating The Incredible Machine with AGS...

Seriously?  How did it turn out?

I've been thinking about learning C (whichever version is the better version.. shows how much I know :P), or just do basic physics with AGS.  Depends really on what kinds of physics I end up learning.

Wonkyth

Not too good, I think.
He had a bit of trouble with elastic collisions.
If you want to have a look, it's on his website, called Lenny the Labrat.
"But with a ninja on your face, you live longer!"

paolo

Quote from: Ryan Timothy on Sun 01/02/2009 03:22:01
So I'm still on the hunt for some nice simplified physics equations or what-not if anyone happens to know of any.

Sir Isaac Newton is your friend here... check out http://en.wikipedia.org/wiki/Classical_mechanics for an introduction, although depending on your maths you might not find this easy to convert into nice simplified physics equations.

If you want to do the maths yourself, then a knowledge of vectors, Newton's third law and the conservation of linear momentum (and maybe conservation of angular momentum too) are going to be essential.

OK, here goes with some equations you might find handy. The bold letters are vectors. These will work whatever units you use because they don't involve any universal constants, but beware - some equations in standard use by physics, such as  the one describing how two massive objects (eg, the Earth and the Moon) move relative to one other, require you to use SI units (seconds, metres, kilograms, newtons, metres per second, metres per second per second, etc).

F = ma : force = mass times acceleration. Put simply, the more massive (by which I mean heavier, not bigger) an object, the harder you have to push or pull it to make it speed up, slow down or change direction.

s = v0t + at^2 / 2 : this gives the position of a moving object acted on by an acceleration a. The vector v0 is the object's initial velocity, and t is time in seconds. One common use of this is for the acceleration to be gravity (a = (0, -9.81) on Earth), which allows you to work out the paths of objects fired out of cannons and the like.

m1u1 + m2u2 = m1v1 + m2v2 : conservation of linear momentum. Two objects with masses m1 and m2 that start off moving with respective velocities u1 and u2 and then collide end up with respective velocities v1 and v2. This law of physics means, for example, that if you throw a solid, light object against a solid, heavy object, the light object will bounce off at about the same speed as it was going at before, while the heavy object will hardly move at all.

And that's just for starters... I hope it helps.

Ryan Timothy B

Quote from: paolo on Wed 04/02/2009 12:51:16
Sir Isaac Newton is your friend here...

Oh boy....  Why does Wikipedia always make things look so unorganized and confusing.   :-\  I'll definitely take a long hard study at the wiki entry though.
Perhaps what I need is a nice high school physics textbook, since they always seem to explain things in terms easily understood.  Now I'm regretting that while I was in school, I didn't take physics or even additional math classes other than the required amount, since lately I've been finding it very useful.


Quote
And that's just for starters... I hope it helps.

I hope it does too.  Thanks.
The 'cannon' formula you showed me I had previously played around with prior to deciding I'd like to try making my own physics game.  Although my results weren't exactly what I had expected, due to me cutting corners  :-[.


Yesterday I was doing some heavy searching and I found myself this website:
http://box2dflash.sourceforge.net/

It's got an amazing flash demonstration that you can play.  For example, rag doll physics using rectangles for the body parts and elastic joints.  It seems very easy to use.  I even checked out the forums and read some of the user reviews.
I believe it's the physics engine used by Fantastic Contraption.
I'll definitely be checking it out.  I'm curious how they manage to control all the objects at once, because the only way I'd understand how to control an object would be one at a time with a while/for statement.  But I read they control all the objects as a 'world' rather than one at a time individually.  Seems a little beyond my understandings at this very moment, I'm going to have to poke through some scripting. :P

paolo

Quote from: Ryan Timothy on Thu 05/02/2009 03:39:18
Yesterday I was doing some heavy searching and I found myself this website:
http://box2dflash.sourceforge.net/

It's got an amazing flash demonstration that you can play.  For example, rag doll physics using rectangles for the body parts and elastic joints.  It seems very easy to use.  I even checked out the forums and read some of the user reviews.
I believe it's the physics engine used by Fantastic Contraption.

Yes, this is the sort of thing you will need. Coding the equations from scratch will be tough unless you have a firm grip on the physics involved, so it makes sense to use something that already does all the difficult stuff for you. Bit like AGS, really :)

Ryan Timothy B

Well... I wasn't exactly looking at coding a Fantastic Contraption game or anything (at least not without Box2d, ODE, or the others).. I was just hoping to code my own simple two weights separated by a bar.  Then go from there and possibly making three weights connected in the shape of a triangle.  I wasn't even planning on making them interact with each other (due to the simplicity of the game itself).

But for the more advanced coding and math, I'll definitely not be doing it myself.

Wonkyth

If it works, I'd like to try myself!
It'll certainly be interesting... :)
"But with a ninja on your face, you live longer!"

SMF spam blocked by CleanTalk