Need Help on SOFT BODIES (2D - loco roco style)

Started by
7 comments, last by oliii 17 years, 7 months ago
First of all, hi, this is my first post in years. I'm a Lua programmer (yes we do exist) and I'd like to get a little demo out involving rudimentary physics. More precisely Soft Bodies. I'd like to have flat circles in which I can click and as I drag them around, they would follow smoothly the direction I drag them in, deforming themselves according to acceleration, and eventually go back to the round shape as I unclick them. I can't think of any real-life examples (maybe soap bubbles) or demos involving this type of physics. I searched for Java applets as well. So I need two things: 1) If you know of an existing solution, please link me up. 2) Otherwise, what kind of calculations am I looking at? I can use VB or Delphi for RAD. Oh and eventually this would be integrated into a Nintendo DS project... in case you're interested... [Edited by - xradicalx on September 19, 2006 1:54:08 AM]
Advertisement
I would model the perimiters of the "bubbles" as a series of interconnected rigid bodies. That is, have about 10 or 20 nodes connected to each other in a circle. Similar to the way OpenGL draws circles by subdividing them into a series of straight lines.

Then you need to apply a bunch of springs between all the points. That should make something that tries to reach equilibrium in a circle, but can still deform the way you want.

Then you can "attach" a point in the circle to the mouse and it should behave wiggily.
[size=2]Darwinbots - [size=2]Artificial life simulation
I'd just simulate some particles attached together by springs. The fact that it's a circle at rest doesn't seem that useful... So something like this, where particles are x's and lines are springs:
  x____x  /\  /\'x/__\/__\x \  /\  /  \/__\/  x    x

Although obviously you'd want more than a hexagon. How you set up the springs and particles is really up to you, just see what works well. Might not be what you want, but it's simple enough to try out.

EDIT: I see Numsgil has suggested something similar.
___________________________________________________David OlsenIf I've helped you, please vote for PigeonGrape!
You might want to test the perimeter connections, but I think using rigid bodies instead of springs for the perimiter is going to keep things stabler and smoother looking.

Definately springs for the non-perimeter connections.
[size=2]Darwinbots - [size=2]Artificial life simulation

If I were charged with such a task I would implement a 2D version of the following:

http://www.ep.liu.se/ecp/010/007/ecp01007.pdf

and use the method described in the following article to calculate the area of the soft bodies:

http://www.gamedev.net/reference/articles/article2247.asp
Thanks for everything you guys, this place is a lot friendlier than it used to be...

I just found the perfect example of what I want to emulate... the Loco Roco game for PSP, just check out the trailer if you've never seen it:

http://www.us.playstation.com/Content/OGS/UCUS-98662/Site/

scratch emulate, it's EXACTLY what I want to do, except without the smily faces.

So really, where would I begin?
ok, here is a couple of examples of things similar.

http://uk.geocities.com/olivier_rebellion/rigid.zip

http://uk.geocities.com/olivier_rebellion/wh1.zip

it's based on Thomas Jakobsen's stiff constraints stuff.

http://www.teknikus.dk/tj/gdc2001.htm

have fun.

Everything is better with Metal.

oliii dude... the first one is exactly what I was looking for! I'll study your code.

On the other hand, the second zip doesn't wanna load.

it gives me a "__glutInitWithExit could not be located in glut32.dll" error

I downloaded the 3.7 beta ones from the SGI website... what should I install?

If anyone has any other examples -- not using OpenGL this time -- please let me know!! But this really puts me in the right direction.
ha, some crap GLUT stuff... I guess you'll have to re-compile and re-link... It's lust using the wrong libs, not compatible with the DLL.

The second one is basically a 'stick' car, that rolls on a terrain. Just to show you can make articulated bodies. It's also not using spheres as collision objects, but like jakobsen, just sticks.

Everything is better with Metal.

This topic is closed to new replies.

Advertisement