Blob using line segments and damped rotary springs?

Official forum for the Chipmunk Physics Library.

Blob using line segments and damped rotary springs?

Postby fictionpuss on Sun Feb 07, 2010 9:18 pm

I'm trying to simulate a cell-like structure - accuracy not as important as aesthetics - but which will be able to shape itself accordingly to its environment, or a rough circle with no other obstacles present. So I start with a circle approximated by X line segments for the membrane, attached by pin-joints, and using a damped rotary spring between the line-segments to coerce a general sense of cohesion.

The problem is that when the blob deforms it either flattens like a pancake, or zooms around in a swarm of points, until chipmunk locks up.

So I'm starting to think my solution may be stupid, but I can't think of an alternative - any suggestions greatly appreciated, thanks!
fictionpuss
 
Posts: 5
Joined: Tue Oct 02, 2007 9:22 pm

Re: Blob using line segments and damped rotary springs?

Postby slembcke on Mon Feb 08, 2010 9:49 am

Adding too many joints to a set of bodies in a loop can sometimes make the entire thing unstable. I think this is because there is a small amount of error in the solution of each joint. When you have too many joints connecting a group of bodies, the error can add up quickly and run away with itself. Adding the joints in a random order instead of in order might help.

Using damped rotary springs would simulate a stiff surface, but wouldn't really give the blob any internal pressure. Try putting damped springs between opposite sides inside your blob instead maybe. That would give it a very floppy loose surface but make it look like it gets it's shape from having fluid inside. I would expect it to be more stable too.
I'm the guy that wrote Chipmunk. Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 1485
Joined: Tue Aug 14, 2007 7:13 pm

Re: Blob using line segments and damped rotary springs?

Postby ShiftZ on Mon Feb 08, 2010 3:04 pm

Try pin joints. And inner pressure simulate by adding force to every segment (90 degree to its lenght). And magnitude of force define by blobs bounded space. I know its difficult to determine bounded space of concave shape, but i belive there should be kind of approximation.
ShiftZ
 
Posts: 52
Joined: Sat Mar 07, 2009 7:23 am

Re: Blob using line segments and damped rotary springs?

Postby Rawlyn on Wed Feb 10, 2010 11:57 am

I did something similar recently with pymunk (to play with the new damped springs). I basically had a circular arrangement of small, light circles. Each one was attached to the next with a spring, but was also attached to the circle on the opposite side with a spring. That seemed to work pretty well.

At the moment I'm working in C on a similar thing, but now my blob needs to follow an arbitrary position in the space. So now I have an infinite body that I'm moving around manually, and each circle is attached to it's neighbour as before but instead of being attached to it's opposite member it gets attached to the infinite body. This is also working very nicely.

I found it helped a lot to experiment with different combinations of the number of circles around the edge and the spring forces involved. The springs can afford to be pretty weak, because there are a lot of them.

It's not going to be the most efficient way of doing it, but it works in most cases. I has trouble colliding with the "point" of a sharp poly though - gets torn apart and starts going mental like you describe. I solve that by eliminating pointy bits from me level design :D
Image
Rawlyn
 
Posts: 33
Joined: Mon Mar 30, 2009 3:06 am


Return to Chipmunk Physics

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron