setReferencePoint causing a physics bug

myRectangle:setReferencePoint(display.BottomCenterReferencePoint) is causing a physics bug where the collision does not occur where expected.  The object collides for some time prior to the collision event being triggers

have reported as bug

-- Version 2013.1178 (2013.8.2) local physics = require( "physics" ) physics.start() physics.setGravity(0, 0.5) physics.setDrawMode( "hybrid" ) -- SETUP OBJECTS local crate2 = display.newRect(0,300,600,60) local myRectangle = display.newRect(180, 120, 90,90) myRectangle.rotation = -80 myRectangle:setReferencePoint(display.BottomCenterReferencePoint)&nbsp;&nbsp;&nbsp;&nbsp;-- \<=== TRIGGERS BUG -- ADD PHYSICS physics.addBody( crate2, "static" ) physics.addBody( myRectangle, "dynamic" ) -- TURN OBJECT RED WHEN IT HITS myRectangle:addEventListener( "collision", &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;function(event) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myRectangle:setFillColor(200, 0, 0) &nbsp;&nbsp;&nbsp;&nbsp;end ) &nbsp;

Physics only works with center reference point I think but not sure I do t do much with physics

I note at http://developer.coronalabs.com/content/game-edition-physics-bodies

When you turn a display object into a physics object, the Physics engine owns the object and has its own rules about the object. Physics assumes the reference point of the object is the center of the object so object:setReferencePoint() may change the reference point from Corona’s Display Object point of view but not for the Physics engine. This affects collisions and how other physics bodies interact.

The same applies for scaling and rotating the object. You can scale the object up or down and rotate it but the Physics engine still sees the object as it was before the changes.

You can see how the Physics engine view the object with physics.setDrawMode(“debug”).

Someone from CoronaLabs might like to clarify however:

a) My reading is that as long as you don’t change the reference point (or rotate/scale) AFTER you add the physics body it should work?

b) In any case the “setDrawMode” is not showing the right boundary as the doco suggests it should

Sorry - notes this is close to http://forums.coronalabs.com/topic/37907-setreferencepoint-caused-incorrect-physics-boundary-not-align-with-setdrawmode-hybrid/#entry196688

Physics only works with center reference point I think but not sure I do t do much with physics

I note at http://developer.coronalabs.com/content/game-edition-physics-bodies

When you turn a display object into a physics object, the Physics engine owns the object and has its own rules about the object. Physics assumes the reference point of the object is the center of the object so object:setReferencePoint() may change the reference point from Corona’s Display Object point of view but not for the Physics engine. This affects collisions and how other physics bodies interact.

The same applies for scaling and rotating the object. You can scale the object up or down and rotate it but the Physics engine still sees the object as it was before the changes.

You can see how the Physics engine view the object with physics.setDrawMode(“debug”).

Someone from CoronaLabs might like to clarify however:

a) My reading is that as long as you don’t change the reference point (or rotate/scale) AFTER you add the physics body it should work?

b) In any case the “setDrawMode” is not showing the right boundary as the doco suggests it should

Sorry - notes this is close to http://forums.coronalabs.com/topic/37907-setreferencepoint-caused-incorrect-physics-boundary-not-align-with-setdrawmode-hybrid/#entry196688