Physics Body Anchor Point

I have a problem regarding anchor point for physics body. From http://docs.coronalabs.com/api/library/physics/addBody.html the docs said " The engine also assumes that the anchor point is at the center of the object." My question is how do I change the anchor point for physics body to something other than center of the object? Thank you.

Hi @akmalazlan89,

When using physics, you need to work with the central anchor point when positioning the objects. If you shift the anchor point, it will shift the display object associated with the physics object, but it won’t shift the body, so you’ll get incorrect collisions.

Best regards,

Brent

Hi @akmalazlan89,

When using physics, you need to work with the central anchor point when positioning the objects. If you shift the anchor point, it will shift the display object associated with the physics object, but it won’t shift the body, so you’ll get incorrect collisions.

Best regards,

Brent

This is not what is wrriten in the corona document and I quote (From the addBody API)

“If you change the anchorX or anchorY property of a display object before adding a physics body, the body will be positioned properly relative to the adjusted anchor. However, you should  not  change the anchor point after adding the body or the object and body will be misaligned.”

Which mean, that if I change the anchor of the display objects before addbody everthing should be OK
(and this is not the case)

Hello @yuval_forish,

Which build of Corona are you using? Can you provide some code showing how you’re setting up the object and physics body?

Brent

This is not what is wrriten in the corona document and I quote (From the addBody API)

“If you change the anchorX or anchorY property of a display object before adding a physics body, the body will be positioned properly relative to the adjusted anchor. However, you should  not  change the anchor point after adding the body or the object and body will be misaligned.”

Which mean, that if I change the anchor of the display objects before addbody everthing should be OK
(and this is not the case)

Hello @yuval_forish,

Which build of Corona are you using? Can you provide some code showing how you’re setting up the object and physics body?

Brent