PDA

View Full Version : Realistic physics


Snuk the Great
03-13-2005, 05:14 PM
Hello,
I am looking for anyone that can help me with a bit more advanced question. I am working o a nice flash game wich is a side scrolling action/shooting game. Now I know most of the code i need, except for this. A realistic way to let people shoot (for example) a barrel and then it would realisticly turn and fall (aka Half-life 2 but then 2d :) ). Now I have seen and tried multiple things on the net, but none were usefull.

Anybody here who could help me out?

Laguana
03-14-2005, 04:51 AM
That kind of physics is actually hard to do properly (or so i think). I found a website which had a java applet which let you move rectangles into each other, and they span off depending on where it hit - However, the maths involved was quite complex, involving vectors and matricies and stuff. You might be better off just approximating it (like having barrels just break regardless of where they are hit)

Snuk the Great
03-14-2005, 10:18 AM
That might be the easy way, but I want it the complex way :). I think I know wich one you mean (http://actionscript-toolbox.com/samplemx_bounceCollide.php). But it is not as accurate as it should be.
Now I am not asking for the Actionscript instantly, I could realy use the Scientific 'look' at it. Just think with me. It is not the bouncing that is difficult, it is the turning that is, how can I make something turn the right way and what would be the scientifical explenation of it.
If you have no clue than look at the link, and than think more stable and more accurate, cause that should be possible :)

Laguana
03-14-2005, 10:37 AM
Well, the site which explained it most to me was http://www.myphysicslab.com/collision.html. It's got a java applet at the top showing you the result, and if you scroll down to near the bottom the section on rigid body collisions in two dimensions will explain how things spin off when they're hit and such.

Sorry i can't be much help, but I don't understand it myself yet, and that site seemed pretty good.

Snuk the Great
03-14-2005, 10:50 AM
Thank you a whole lot, that was about what I was looking for. I will c if I can get it to work properly and then I might post an example here for other people :)
Though I am not sure if I get it done :o