Circle Fixture Position

I am trying to set the position (x,y) of a circle fixture unsuccessfully. Box2d supports this behavior, but Corona doesn’t appear to support it. Can someone point me in the right direction, or let me know where to request this functionality.

Thank you!
[import]uid: 58738 topic_id: 35362 reply_id: 335362[/import]

If you are asking about changing the reference point of a physics object in Corona, you can’t. It’s fixed at the center of the object.

You can request new features at our feedback page.
http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback [import]uid: 7559 topic_id: 35362 reply_id: 140562[/import]

I mean like in box2d setting the position of a circle:

b2CircleShape circle;  
circle.m\_p.Set(2.0f, 3.0f);  
circle.m\_radius = 0.5f;  

If this isn’t possible, then what is the best way to have a body with multiple shapes, like, e.g., a rectangle with a circle at each corner (w/o using joints) ?

[import]uid: 58738 topic_id: 35362 reply_id: 140580[/import]

Hi @jwall,
I assume your intent is an “offset” circle shape, as in a display object with a circular physics body, but that body isn’t centered around its origin. I would suggest you create this body using a polygon to create the “circle” (or perhaps 2 polygons; one for each half circle) so the overall shape is more accurate with 16 sides instead of 8.

You can create multi-shape bodies using the following method in Corona. Just do a “Find” on “Complex body construction” on this page:
http://developer.coronalabs.com/content/game-edition-physics-bodies

Hope this helps!
Brent [import]uid: 200026 topic_id: 35362 reply_id: 140593[/import]

Hi @brent,

This does help. I was hoping I could have a complex body composed of actual box2d circle shapes as I do in cocos2d, but it seems in Corona the best approach is what you describe or to use joints.

Do you foresee this being supported in the future (I saw Better fixture control in the roadmap)?
Thank you again for your quick help!
Jamie [import]uid: 58738 topic_id: 35362 reply_id: 140633[/import]

Hi Jamie,
Did you get this working reasonably well? I’m not sure if there’s a capped limit on the number of body elements for a complete body, as I’ve only gone about as high as 9 parts. I’ve never heard of a limit, and since Box2D seems to cap some things at 8 (sides to a polygon for example), I’m hopeful that there’s no practical limit, and you could get quite detailed circular shapes. Of course, using a helper tool like PhysicsEditor would make it much easier (http://www.codeandweb.com).

I agree that improved fixtures would be nice, along with some other additions to the physics engine. However, we haven’t gotten too many requests for fixtures/positioning. If you’d like to cast your votes for this or other physics-related additions, you can do it here… assuming you haven’t already expended your votes. :slight_smile:
http://feedback.coronalabs.com/

Brent [import]uid: 200026 topic_id: 35362 reply_id: 140813[/import]

Hi Brent,

Yes, I have a solution that is working. I am using a helper tool :slight_smile: LevelHelper/SpriteHelper. That is where the problem first cropped up because in other engines my shapes looked fine, but with Corona all circle shapes went to 0,0. So, I am using a different solution for now.

I will consider adding this request in feedback, but votes are so valuable I will have to weigh this appropriately.
Thank you again!

Jamie [import]uid: 58738 topic_id: 35362 reply_id: 140816[/import]

If you are asking about changing the reference point of a physics object in Corona, you can’t. It’s fixed at the center of the object.

You can request new features at our feedback page.
http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback [import]uid: 7559 topic_id: 35362 reply_id: 140562[/import]

I mean like in box2d setting the position of a circle:

b2CircleShape circle;  
circle.m\_p.Set(2.0f, 3.0f);  
circle.m\_radius = 0.5f;  

If this isn’t possible, then what is the best way to have a body with multiple shapes, like, e.g., a rectangle with a circle at each corner (w/o using joints) ?

[import]uid: 58738 topic_id: 35362 reply_id: 140580[/import]

Hi @jwall,
I assume your intent is an “offset” circle shape, as in a display object with a circular physics body, but that body isn’t centered around its origin. I would suggest you create this body using a polygon to create the “circle” (or perhaps 2 polygons; one for each half circle) so the overall shape is more accurate with 16 sides instead of 8.

You can create multi-shape bodies using the following method in Corona. Just do a “Find” on “Complex body construction” on this page:
http://developer.coronalabs.com/content/game-edition-physics-bodies

Hope this helps!
Brent [import]uid: 200026 topic_id: 35362 reply_id: 140593[/import]

Hi @brent,

This does help. I was hoping I could have a complex body composed of actual box2d circle shapes as I do in cocos2d, but it seems in Corona the best approach is what you describe or to use joints.

Do you foresee this being supported in the future (I saw Better fixture control in the roadmap)?
Thank you again for your quick help!
Jamie [import]uid: 58738 topic_id: 35362 reply_id: 140633[/import]

Hi Jamie,
Did you get this working reasonably well? I’m not sure if there’s a capped limit on the number of body elements for a complete body, as I’ve only gone about as high as 9 parts. I’ve never heard of a limit, and since Box2D seems to cap some things at 8 (sides to a polygon for example), I’m hopeful that there’s no practical limit, and you could get quite detailed circular shapes. Of course, using a helper tool like PhysicsEditor would make it much easier (http://www.codeandweb.com).

I agree that improved fixtures would be nice, along with some other additions to the physics engine. However, we haven’t gotten too many requests for fixtures/positioning. If you’d like to cast your votes for this or other physics-related additions, you can do it here… assuming you haven’t already expended your votes. :slight_smile:
http://feedback.coronalabs.com/

Brent [import]uid: 200026 topic_id: 35362 reply_id: 140813[/import]

Hi Brent,

Yes, I have a solution that is working. I am using a helper tool :slight_smile: LevelHelper/SpriteHelper. That is where the problem first cropped up because in other engines my shapes looked fine, but with Corona all circle shapes went to 0,0. So, I am using a different solution for now.

I will consider adding this request in feedback, but votes are so valuable I will have to weigh this appropriately.
Thank you again!

Jamie [import]uid: 58738 topic_id: 35362 reply_id: 140816[/import]