Need to attach multiple bodies together... make a multi part physics body or use joints?

I’m trying to figure out the best process for attaching two bodies together.

Is there a way to create multi part physics bodies? If so, can someone point me in the right direction for information regarding setting that up?

The best I’ve found is related to creating joints but I’ve not been able to get a basic “weld” joint to work yet…

My ultimate goal is to be able to create a collection of objects that move in relation to each other with different sizing/orientation so they can detect collisions from different “sides” of the aggregate object.

Is this the correct approach for this?

Thanks :slight_smile: [import]uid: 105707 topic_id: 33333 reply_id: 333333[/import]

Hello,
A multi-part physics body is more “stable” than a body of welded-together objects. Although you’d expect the behavior to be identical, weld joints can still exhibit a slight amount of “flex” under high forces. A multi-element body moves as one, in unison.

How to set it up is here, under “Complex body construction”:
http://developer.coronalabs.com/content/game-edition-physics-bodies

You can also get the index number of each body part during collision. That info is contained in the collision guide:
http://developer.coronalabs.com/content/game-edition-collision-detection

There are distinct cases where two or more welded bodies are necessary… say, you really need to treat them as unique, distinct objects, but move them together as one. In your case however, I think a multi-element body is the correct method.

Best of luck!
Brent Sorrentino [import]uid: 9747 topic_id: 33333 reply_id: 132381[/import]

Hello,
A multi-part physics body is more “stable” than a body of welded-together objects. Although you’d expect the behavior to be identical, weld joints can still exhibit a slight amount of “flex” under high forces. A multi-element body moves as one, in unison.

How to set it up is here, under “Complex body construction”:
http://developer.coronalabs.com/content/game-edition-physics-bodies

You can also get the index number of each body part during collision. That info is contained in the collision guide:
http://developer.coronalabs.com/content/game-edition-collision-detection

There are distinct cases where two or more welded bodies are necessary… say, you really need to treat them as unique, distinct objects, but move them together as one. In your case however, I think a multi-element body is the correct method.

Best of luck!
Brent Sorrentino [import]uid: 9747 topic_id: 33333 reply_id: 132381[/import]

Hi Brent,

The link to “Complex Body Construction” is exactly what I needed, I appreciate that! I’ve been pouring over the documents but had somehow missed that section…

I had seen the information on collision detection but think that will make more sense for me now.

Thank you for the help :slight_smile: [import]uid: 105707 topic_id: 33333 reply_id: 132539[/import]

Hi Brent,

The link to “Complex Body Construction” is exactly what I needed, I appreciate that! I’ve been pouring over the documents but had somehow missed that section…

I had seen the information on collision detection but think that will make more sense for me now.

Thank you for the help :slight_smile: [import]uid: 105707 topic_id: 33333 reply_id: 132539[/import]

Hi Brent,

This is neat. Not only have I set up a complex body, but I’ve been able to set up collision filters and have success with those as well.

If all the shapes of a complex body are set through their filters to impact with another body, is there a way to determine which shape of the complex body was touched?

I’m working on a solution for a platformer game to determine when the player can jump. If the player’s “feet” are on a platform, I would like the player to be able to jump. If the Player brushes the side of a platform, I would like to not let them jump (currently, with a single body player, whenever the it collides with any side of a platform, the player is able to jump even if they’re just brushing the side. I have set up a solution to check the height of the player vs. the height of the platform object but it’s not 100% reliable)

Thanks for any insight you have on detecting which shape of a complex body has been touched :slight_smile:
[import]uid: 105707 topic_id: 33333 reply_id: 132729[/import]

Hi Brent,

This is neat. Not only have I set up a complex body, but I’ve been able to set up collision filters and have success with those as well.

If all the shapes of a complex body are set through their filters to impact with another body, is there a way to determine which shape of the complex body was touched?

I’m working on a solution for a platformer game to determine when the player can jump. If the player’s “feet” are on a platform, I would like the player to be able to jump. If the Player brushes the side of a platform, I would like to not let them jump (currently, with a single body player, whenever the it collides with any side of a platform, the player is able to jump even if they’re just brushing the side. I have set up a solution to check the height of the player vs. the height of the platform object but it’s not 100% reliable)

Thanks for any insight you have on detecting which shape of a complex body has been touched :slight_smile:
[import]uid: 105707 topic_id: 33333 reply_id: 132729[/import]

Hi @EHO,
Did you look for that information in the physics collision guide? It should be in there… a method about accessing the “index” of the particular body piece (from the order in which you declared them when you created the multi-body). You can then use this index to determine which piece has been contacted.

Brent
[import]uid: 200026 topic_id: 33333 reply_id: 132950[/import]

Perfect!

I had tunneled in on the collision masking information further down in the collision detection link and missed the multi-element body collision information.

With your tip on what to look for, it took me about 3 minutes to find it, understand it and implement it.

Thanks :slight_smile: [import]uid: 105707 topic_id: 33333 reply_id: 133023[/import]

Hi @EHO,
Did you look for that information in the physics collision guide? It should be in there… a method about accessing the “index” of the particular body piece (from the order in which you declared them when you created the multi-body). You can then use this index to determine which piece has been contacted.

Brent
[import]uid: 200026 topic_id: 33333 reply_id: 132950[/import]

Perfect!

I had tunneled in on the collision masking information further down in the collision detection link and missed the multi-element body collision information.

With your tip on what to look for, it took me about 3 minutes to find it, understand it and implement it.

Thanks :slight_smile: [import]uid: 105707 topic_id: 33333 reply_id: 133023[/import]