Static body connection

Official forum for the Chipmunk2D Physics Library.
morsmodre
Posts: 22
Joined: Sat Feb 09, 2008 2:55 am
Contact:

Static body connection

Post by morsmodre »

Hi!

I want to connect to bodies in a static way. That i,s they stay in at the same distance even if rotated or pushed. More then that a torque applied to one of them would rotate the other.

At first I tried Pin Joints but the rotations applied aren't kept. For example, if I have bodies being tree points of the triangle and the joins being its sides (only two sides), a force aplied to one of the points would destroy the original triangle form.

Then I when for the Pivot Joints (which appeared to be perfect for this). But the problem is the same. In order for the triangle to mantain its shape I need the tree sides to be need to defined as a join. This does not scale well ... For more "points", all should be joined with all to get a perfect shape mantainance.

I also though about puting various shapes in one body, giving the visual impression of various things. Unfortunatly, project constrains don't allow me to do so.

Anyone has any ideia how can I solve this problem?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Static body connection

Post by slembcke »

It sounds like just you want to attach more than one shape to the same body. You can associate as many shapes as you want with a single body.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
morsmodre
Posts: 22
Joined: Sat Feb 09, 2008 2:55 am
Contact:

Re: Static body connection

Post by morsmodre »

Thats exactly what I wanna do in a conceptual point of view.

Unfortunatly I cannot it ... isn't there a way to do it with diferent bodies?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Static body connection

Post by slembcke »

Why not? What API are you using that doesn't allow it?
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
morsmodre
Posts: 22
Joined: Sat Feb 09, 2008 2:55 am
Contact:

Re: Static body connection

Post by morsmodre »

its not because of the API its a project dependency thing.

I've been trying to get joins to do the job ... do you have any ideia for it?

Rigth now I'm having two PinJoins connected as in a). Theoretically, since the size is fixed the bodies should hold thier rataion and position (just as they were two shapes in a single body).

Unfortunatly, the sizes don't hold and, through time, they stay like b).

Any idea of what might be hapening? :oops:
Pipo
Posts: 13
Joined: Thu Jan 03, 2008 11:27 am
Contact:

Re: Static body connection

Post by Pipo »

I don't know, but how about using a Pi Joint and a Pivot joint to join two bodies? This might conserve the distance and the angle.
morsmodre
Posts: 22
Joined: Sat Feb 09, 2008 2:55 am
Contact:

Re: Static body connection

Post by morsmodre »

oh ... herte is the a) and b)

As explained in the previous post ... the color things are pin joins that pass, over time, from a) to b).

I'll try to do the pivot + pin now.

Image
Android_X
Posts: 18
Joined: Wed Oct 31, 2007 7:55 pm
Contact:

Re: Static body connection

Post by Android_X »

I am also interested in being able to have multiple bodies connected with joints that act like a single body.

I would find it useful in situations where the joints are temporary.
e.g. you have a car where the spoiler, bonnet and doors are separate bodies that have the "static connection" to the car frame but can be detached from the car when it crashes or bumps into somthing. So the car frame, spoiler, bonnet and doors can act like single body but can also separate or join at some time.

If the "static connection" is to hard, another thought was that you could have a function that merges the shapes from two bodies into one body, and in reverse a function that can separate shapes from a body, creating a new body with just that one shape.

Regards, AX
morsmodre
Posts: 22
Joined: Sat Feb 09, 2008 2:55 am
Contact:

Re: Static body connection

Post by morsmodre »

I'm doing something a little bit different ... I'm walking around with agent swarms ...

a static join maintain the decentralized control in a more-then-conceptual kind of way.

ideas for it?
Pipo
Posts: 13
Joined: Thu Jan 03, 2008 11:27 am
Contact:

Re: Static body connection

Post by Pipo »

Did you try the Pin+Pivot connection? For me, it worked perfectly, as if the two bodies were one.
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests