multiple circular bodies for complex physics objects

EDIT: As has been pointed out below, the issue isn’t that you can’t assign more than one circle body to an object (which you can), but that you can’t set the position of each circle body independently. They all end up centered on the same x,y position. Glad this is finally getting some attention.

I’d like to be able to define more than one circular body shape for an object in order to build up a complex physics body made up entirely of circles.

Currently Corona only allows one circular body shape for an object and it is always centered on the display object’s bounding box center. I’d like to be able to define a circle body by radius AND x,y coordinates local to the object and assign multiple circles to the object the same way I can already assign multiple polygonal bodies to it.

Why? I’m having issues where jointed physics objects collide with sharp edges on other static objects and get hung up on the corners, pulling the joints apart. The only work around seems to be to make sure there are no sharp edges by making ALL physics bodies out of circles. So, for a brick, I’d want to use 4 circles, one at each corner of the brick.

Custom polygons don’t work well for this since the max # points is 8 and the shape is more like a stop sign than a circle. There are still enough sharp corners on an 8 sided circle that other objects get hung up on them. [import]uid: 9422 topic_id: 8804 reply_id: 308804[/import]

Just ran into this limitation too.

I was hoping to have rectangular spaceships with circular gun turrets… this appears to be impossible using complex body construction (as described in the “car example” here: http://developer.anscamobile.com/content/game-edition-physics-bodies#Complex_body_construction), since the “radius” property always creates a centered circle.

What’s really annoying is clearly it CAN support multiple circular shapes… you can do things like physics.addBody( obj, { radius = 20 }, { radius = 50 } ) and see the two different circles in hybrid mode… you just can’t change their center points. :frowning:

Looks like I will have to try implementing them using joints (despite the documentation for Weld joints specifically saying it’s probably better to use complex bodies instead). [import]uid: 70530 topic_id: 8804 reply_id: 44602[/import]

I would also like to chime in on this request. Being able to include a circle in a complex body can make it possible for objects to react more realistically. This should definitely be included. [import]uid: 31262 topic_id: 8804 reply_id: 47307[/import]

+1 [import]uid: 2927 topic_id: 8804 reply_id: 58126[/import]

+1, this is a no-brainer! [import]uid: 49447 topic_id: 8804 reply_id: 78928[/import]

Passing this onto the team :slight_smile: [import]uid: 84637 topic_id: 8804 reply_id: 80912[/import]

Fascinating stuff.
@XenonBL or anyone here provide a small code snippet and a simple drawing of what you want?
I have figured out a lot of things that people said it’s not possible with Box2d, but did it anyway. I’m new to coding since June 2011, and I like challenges :slight_smile:

I don’t want your project, I just want just the shape hand drawn, and what you were trying to do :slight_smile:

-ng [import]uid: 61600 topic_id: 8804 reply_id: 80934[/import]

@nicholasclayg -This isn’t a limitation of Box2D. it’s a limitation of Corona’s own method of automatically creating a circle physics body, like bcairns illustrated:

physics.addBody( obj, { radius = 20 }, { radius = 50 } )

That creates more than one circular physics body attached to a single object, each with different different radii. But because there are no x,y parameters for each circle they all just get stacked on top of each other, centered presumably over the bounding box of the display object.

It’s possible to use external tools to help create “complex” bodies, but if they have more than eight sides (as a circle body does) then multiple bodies are required just to simulate a single circle.

The corona version is simple and convenient to use and doesn’t require a 3rd party tool. It’s just missing a critical feature that would make it way more useful.

[import]uid: 9422 topic_id: 8804 reply_id: 80943[/import]

@nicholasclayg my original use case as described above was a rectangular shapeship with circular gun turrets… something like:

+--O---O--+
| |
| |
+--O---O--+

So, four circles attached to a rectangle. This isn’t possible with complex body construction, as you cannot provide x,y coords along with the radii, so the circles all end up dead centre.

I ended up attaching them with pivot joints instead, this actually worked out quite well, as having them rotate makes sense for my use case (and I can even control firing arc with joint:setRotationLimits())

But if you wanted it all to be one solid rigid body you’re outta luck, best you can do is use weld joints (which apparently aren’t perfectly rigid). [import]uid: 70530 topic_id: 8804 reply_id: 80948[/import]

+1

Right now I have to make two bodies attached by weld joints [import]uid: 136876 topic_id: 8804 reply_id: 109359[/import]

Just to follow up, it is recommended you post feature requests like this here: http://developer.anscamobile.com/content/bug-submission

It has a better chance of being implemented then [import]uid: 84637 topic_id: 8804 reply_id: 109666[/import]

Good to know this is being looked at, it must be a simple fix for you guys to make.

Would be great if you changed ‘steps to reproduce’ and ‘code to reproduce bug’ on bug-submission form to be optional, or else create a feature-submission form with them removed. It’s annoying to have to provide dummy text and an empty file. [import]uid: 150657 topic_id: 8804 reply_id: 110909[/import]