Dark Bit Factory & Gravity

GENERAL => Projects => Topic started by: Tetra on March 09, 2007

Title: Rigid Body Experiment
Post by: Tetra on March 09, 2007
I got a new :inspired: for the 20s Compo.

Without giving anything away I thought i'd give out a taser. I actually quite enjoyed throwing this square about and thought some my appreciate the same I did.

I've spent the whole day looking at different explinations, all unfortunately math heavy, which i'm not to great on. So I gave up a drew a picture of the problem and came up with this.
Its a bit buggy at the moment and the box seems to have an amazing ability to balance its self on its edge. But I think this is mainly down to the collision detection as I havent yet interpolated ( is that a word :? ) one frame to another to detect the actual time of collision. Also my torque calculations are not entierly exactly what they shuold be. But that doesnt matter :)

My final release will have the full sorce included but for now here an exe

 :cheers:


Title: Re: Rigid Body Experiment
Post by: rdc on March 09, 2007
Nice one. Looks quite realistic.
Title: Re: Rigid Body Experiment
Post by: rain_storm on March 10, 2007
looks spot on to me cant wait to see the final source
Title: Re: Rigid Body Experiment
Post by: benny! on March 10, 2007
Very cool and runs smooth. I am always fascintated by a good physics routine.
Keep it going...
Title: Re: Rigid Body Experiment
Post by: Shockwave on March 10, 2007
That's cool :) I'd love to see this with a few dozen bouncing around and off of each other!
Title: Re: Rigid Body Experiment
Post by: Paul on March 10, 2007
Very good :)
Title: Re: Rigid Body Experiment
Post by: Shockwave on March 11, 2007
Found this Daf, don't know if it is any good though...

Hope it helps!

Rigid Body (http://frontpage.execulink.com/coder/freebasic/rigid.asp)
Title: Re: Rigid Body Experiment
Post by: Tetra on March 11, 2007
Thanx for the encouragment :)

Nice 1 for the link Nick, I will have a look and see if I can make head or tails of it.

Unfortunately I dont think I will be able to get it working how I want for the compo, but, i'll see if I can fake it for that  :diablo:  :updance:

Problem with what you seen is that its is based on the basic equations for force, acceleration and torque but, my understanding is somewhat rusty, and many sites are just too mthematical for me, so I need to brush  up on some maths :(
The code is very specific for the example too, so i I increased the mass for example the whole thing went crazy.

Problem too with code is that no one ever seems to just program a simple box lol, thay have to have loads of boxes with springs, strings complex collisions etc, so I find it hard to follow.

So I scrapped what I had done and started again, but now, the simulation is gaining far too much or far too little energy, wich is a bit annoying. Also i'm not sure how to convert torque to actual rotational velocity in terms of derees per millisec. The result should be radians per second, but it doesnt seem to be.
I've now also included a time based system, and my next goal will be to have some global variable to scale the physics to the pixels on the screen to some relative amount to real life, so gravity actually looks like gravity in the world.

I'll post some code and what I know very soon, maybe some of you will be able to help me accomplish what I set out to do, and maybe we can all learn some cool things from it :)

In th end I want to make it 3D how cool would that be!

 :cheers: