Measuring the force a body applies to another.

Official forum for the Chipmunk2D Physics Library.
Post Reply
ploki
Posts: 1
Joined: Mon Nov 01, 2010 6:43 pm
Contact:

Measuring the force a body applies to another.

Post by ploki »

My chipmunk space has 4 static bodies with 1 segment each one to conform the edges of the screen.
Then I add circles inside, that act as bubbles.
I need to know when the screen is full of bubbles, and as all bubbles are of -very- different sizes, it's not that easy.
So I though of measuring the force the bubbles make to the "walls", but the vector f of the bodies of the walls is always zero, even when all the bubles are pushing the four walls and shaking because they are overlapping and chipmunk is starting to behave weird.
Can I measure the actual force being applied by the other bodies to the wall?

Thanks!
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Measuring the force a body applies to another.

Post by slembcke »

When objects push each other apart because they are overlapping, they don't actually produce real forces that you can retrieve from Chipmunk at a later point. The overlaps aren't fixed using forces at all. This is partly why things get weird when your box gets full and there is no solution for the physics. My suggestion would be to measure the area of all of the circles and the area of the box. The box will probably be "full" at about the same ratio each time. Otherwise I'm not really certain what else would work better.

Also, you can attach multiple shapes to a body, and it's normal to have only 1 static body that all the static shapes attach to unless you have a reason not to.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests