multi element physics body - circles

Hi,

Is there any way to create a multi element physics body consisting of 2 circles that are spaced apart and rotate around a centre point?

I know you can create a graphic and then use a polygon physics body that’s close… but i would prefer to have the actual physics body as a circle.

Hi @Ducky,

Multiple offset circles isn’t possible, so you’ll need to either create these as octagons (or two half-octagons for better precision). Or, you can weld multiple circle bodies together with weld joints.

Best regards,

Brent

hi, I thought that was the case… I’m having some issues figuring a few things out though… my preference is to try the welding option. a few questions though… can I create a weld joint between a and b and then rotate b with transition.to to make a rotate around b? or would I need to use a pivot joint and then the motor function? can the physics body type just be static for either of these options? with the weld option it appeared that it only reacted as one welded object via linear impulse. also, when creating a joint which is stored as a variable as per usual, would it also need to be added to the scene group? I tried to and kept getting an error on that line (not at the computer so not sure what the exact error was, something about expecting a table or using a “.” instead of “:”)… cheers for the assistance!

Hi @Ducky,

I think if you use transitions on one of the objects welded together, it may behave as if the entire welded body is transitioning as a whole. So, if you’re looking for something like a moon orbiting a planet, then you should probably use a pivot joint with a motor OR weld the two bodies together and use physical velocity on the “planet” one. In the latter case, the welded body needs to be dynamic type, otherwise it might not behave in the expected unison with the main body.

Joints can’t be added to display groups, since they’re Userdata objects internally, not display objects. When you destroy one of the joined bodies, the joint should be destroyed as well, however if you put any hanging references somewhere, you should absolutely nil that out.

Hope this helps,

Brent

weld with physical velocity worked well. however my welded bodies don’t seem to be reacting to other dynamic bodies as well. they are over lapping them. would this be affecting their density?

Hi @Ducky,

Can you post a screenshot of your setup, or your code?

Brent

not at the moment… but is their anything in particular to be aware of with ensuring consistent physics response? I have noticed their can be some inconsistencies. eg. 2 dynamic bodies bouncing off each other when over lapped in one instance and then the next they may be a couple of mm away from each other but still bounce off each other.

The first thing to check is how the bodies are interacting in hybrid/debug view… and that’s what I’d need to see for the screenshot anyway.

Brent

yeah I have been running it in hybrid and debug views and the physics bodies can run over top of each other etc. so a circle of radius 15 can run half over the welded body (radius 10) before reacting. but then sometimes it will jump off quickly when very close to touching but not actually touching. I am using a touch and drag function to drag the welded bodies. are the x(red) and y(yellow) lines of the physics bodies supposed to be all the same lengths irrelevant of the body size? mine are. so they will protrude from a small body and are the same length in a larger body.

figured out the x and y lines are based on the physics.setScale property.

I’ve found out a couple of issues…

I have some objects that move from a to b via transition.to. the welded body when dragged behind the transitioning object will knock the transitioning object off course as if reacting with the transitioned path. this can be exaggerated by setting the physics.setScale up quite high. this doesn’t happen if I test with gravity instead of transition.

also, regarding the objects overlapping, this is only happening when the object that is being dragged is set to dynamic… hence it is dynamic reacting with dynamic (transitioning object). if I change the welded object to static then it doesn’t really overlap the transitioning objects… why would that be happening?

Hi @Ducky,

Multiple offset circles isn’t possible, so you’ll need to either create these as octagons (or two half-octagons for better precision). Or, you can weld multiple circle bodies together with weld joints.

Best regards,

Brent

hi, I thought that was the case… I’m having some issues figuring a few things out though… my preference is to try the welding option. a few questions though… can I create a weld joint between a and b and then rotate b with transition.to to make a rotate around b? or would I need to use a pivot joint and then the motor function? can the physics body type just be static for either of these options? with the weld option it appeared that it only reacted as one welded object via linear impulse. also, when creating a joint which is stored as a variable as per usual, would it also need to be added to the scene group? I tried to and kept getting an error on that line (not at the computer so not sure what the exact error was, something about expecting a table or using a “.” instead of “:”)… cheers for the assistance!

Hi @Ducky,

I think if you use transitions on one of the objects welded together, it may behave as if the entire welded body is transitioning as a whole. So, if you’re looking for something like a moon orbiting a planet, then you should probably use a pivot joint with a motor OR weld the two bodies together and use physical velocity on the “planet” one. In the latter case, the welded body needs to be dynamic type, otherwise it might not behave in the expected unison with the main body.

Joints can’t be added to display groups, since they’re Userdata objects internally, not display objects. When you destroy one of the joined bodies, the joint should be destroyed as well, however if you put any hanging references somewhere, you should absolutely nil that out.

Hope this helps,

Brent

weld with physical velocity worked well. however my welded bodies don’t seem to be reacting to other dynamic bodies as well. they are over lapping them. would this be affecting their density?

Hi @Ducky,

Can you post a screenshot of your setup, or your code?

Brent

not at the moment… but is their anything in particular to be aware of with ensuring consistent physics response? I have noticed their can be some inconsistencies. eg. 2 dynamic bodies bouncing off each other when over lapped in one instance and then the next they may be a couple of mm away from each other but still bounce off each other.

The first thing to check is how the bodies are interacting in hybrid/debug view… and that’s what I’d need to see for the screenshot anyway.

Brent

yeah I have been running it in hybrid and debug views and the physics bodies can run over top of each other etc. so a circle of radius 15 can run half over the welded body (radius 10) before reacting. but then sometimes it will jump off quickly when very close to touching but not actually touching. I am using a touch and drag function to drag the welded bodies. are the x(red) and y(yellow) lines of the physics bodies supposed to be all the same lengths irrelevant of the body size? mine are. so they will protrude from a small body and are the same length in a larger body.

figured out the x and y lines are based on the physics.setScale property.

I’ve found out a couple of issues…

I have some objects that move from a to b via transition.to. the welded body when dragged behind the transitioning object will knock the transitioning object off course as if reacting with the transitioned path. this can be exaggerated by setting the physics.setScale up quite high. this doesn’t happen if I test with gravity instead of transition.

also, regarding the objects overlapping, this is only happening when the object that is being dragged is set to dynamic… hence it is dynamic reacting with dynamic (transitioning object). if I change the welded object to static then it doesn’t really overlap the transitioning objects… why would that be happening?