FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Simulation, Artificial Life
(Moderator: REAS)
   blocks falling physics
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: blocks falling physics  (Read 816 times)
ian

WWW
blocks falling physics
« on: Mar 14th, 2004, 3:38am »

hello - i was beginning to work on a simulation with a couple of blocks. what i'd like to do is have two blocks stacked one on top of the other. as the top block slid off the bottom block, i'd like to have it angle over and fall in the way a real block would - ie. instead of waiting until the whole top block was off the lower one, it would begin to fall when enough of it was off the top for gravity to pull it over angularly.  
 
the second part of it would be that when the block fell, it would sort of bounce and settle on whatever face it would happen on. i'm thinking something like a stack of alphabet blocks toppling over. i was wondering what sort of physics would need to be incorporated to have a realistic simulation. sorry i can't be more descriptive but i guess that gets to the heart of the matter - i just don't know what would be involved. thanks.  
 
arielm

WWW
Re: blocks falling physics
« Reply #1 on: Mar 14th, 2004, 9:51pm »

feasible, but not trivial,
 
all the required ingredients are included in this paper:
 
http://www.ioi.dk/Homepages/thomasj/publications/gdc2001.htm
 
an "easy" way to start could be: modeling your blocks as "rigid bodies with constraints", influenced by gravity and, say, some drag force, without dealing with collision detection first.
 
for a demonstration, take look at this one by v3ga...
 
have some fun!
 
ariel
 

Ariel Malka | www.chronotext.org
arielm

WWW
Re: blocks falling physics
« Reply #2 on: Mar 16th, 2004, 11:35pm »

the link provided in the last post seems to be dead, but here's an alternative:
 
http://www.gamasutra.com/resource_guide/20030121/jacobson_pfv.htm
 

Ariel Malka | www.chronotext.org
TomC

WWW
Re: blocks falling physics
« Reply #3 on: Mar 17th, 2004, 12:47am »

Chris Hecker also wrote a series of gamasutra articles that are essential reading if you're going to embark on this kind of project.
 
http://www.d6.com/users/checker/dynamics.htm
 
ian

WWW
Re: blocks falling physics
« Reply #4 on: Mar 22nd, 2004, 2:35am »

thanks all - i'll let you know what i come up with.
 
ian

WWW
Re: blocks falling physics
« Reply #5 on: Mar 22nd, 2004, 2:40am »

ps - i also found some good explanations in that o'reilly game physics book. i've also been playing with the havok engine in director - ends up being about four lines of code there - it's pretty much cheating.
 
v3ga

WWW Email
Re: blocks falling physics
« Reply #6 on: Mar 22nd, 2004, 9:42am »

Hello Ian,
the problem you're trying to solve is not an easy one. Different approaches can be taken, depending on how accurate/fast you want your simulation to run. But mainly you have to deal with two big parts in your project :
 - collision detection (which pairs of boxes are colliding?), which allows to detect geometrical intersections (depth, normals generally)
- physical simulation : forces / acceleration are here considered, and previous contacts found with collision detection have to be "translated" into forces. All is integrated over a certain period of time to get the new position/orientation of your boxes (according to the Newton law F=ma).
The easiest way to do this is called 'penalty-method'. All you have to do is to repair the penetration between each rigid body in contact, in order to get them out of their forbidden state. This method is known to be quite unstable, and depends largely on parameters tuning (ie tweak them until the simulation looks fine).
An alternative would be to use particles simulation as Arielm suggested it (relaxation methods)
Another way would be to solve all the contacts/ collisions whith analitycal methods : it involves some quite rude maths (LCP solving).  
Nevertheless , I suggest you reading papers by David Baraff (http://www-2.cs.cmu.edu/~baraff/), the one called 'An introduction to physically based modeling' is just excellent to have a good overview of physical simulation.
Well hope this will help !
 

http://v3ga.net
Pages: 1 

« Previous topic | Next topic »