Build 2949 Physics Bodies NOT Following new anchor settings?

Hi,

I don’t know if it has something to do with the new build 2949, but I noticed that with this build, my physics bodies no longer obey the anchorX, anchorY settings!!   Only the image follows.

To illustrate what I mean, I have included a very simple code below.  If you can test it, pls see (in Hybrid Draw Mode) if the images and physics align in your simulators.  

In my case, the physics bodies ALWAYS remain on center X,Y, no matter what my anchorX, anchorY values are.  The images however, obey the anchorX/anchorY settings.  In the example, i set the anchorY to .5 and it shifted the anchor accordingly to the cirlce and square, but their respective physics bodies still remain on center x,y. 

physics = require "physics" physics.start() physics.setDrawMode( "hybrid" ) local circle = display.newCircle (200, 100, 30) physics.addBody (circle, "kinematic" ) circle:setFillColor (1,0,0) circle.anchorX = 0 circle.anchorY = .5 circle.x = 100 circle.y = 300 local square = display.newRect( 0, 0, 60, 60 ) physics.addBody (square, "kinematic" ) square:setFillColor (0,0,1) square.anchorX = 0 square.anchorY = .5 square.x = 100 square.y = 100 local function rotation() square.rotation = square.rotation + 3 circle.rotation = circle.rotation + 3 end local x = timer.performWithDelay( 20, rotation, -1 )

I don’t remember having this problem with earlier builds.

Thanks!

Santi

another classic example of a stopwatch…  the clock “hand” should have Y anchor point somewhere at one end, hence in my example, anchorY = .90.   It works, that is, only the images.  The physics of the clock hand remained center.

physics = require "physics" physics.start() physics.setDrawMode( "hybrid" ) local circle = display.newCircle (200, 100, 150) physics.addBody (circle, "static" ) circle:setFillColor (.5,.5,.5) circle.anchorX = 0.5 circle.anchorY = 0.5 circle.x = display.contentCenterX circle.y = display.contentCenterY local hand = display.newRect( 0, 0, 10, 120 ) physics.addBody (hand, "kinematic" ) hand:setFillColor (1,1,1) hand.anchorX = 0.5 hand.anchorY = 0.90 hand.x = display.contentCenterX hand.y = display.contentCenterY local function rotation() hand.rotation = hand.rotation + 6 end local x = timer.performWithDelay( 1000, rotation, -1 )

have you tried setting the anchors before adding the body?

@roaminggamer,

geez!! i knew it was a stupid question… my bad!     I didnt realize the precedence was that important.  It works!  Thanks.

Now I have to re-direct the issue to Level Director X support.   I use LDX with Physics imported from PE, and I can’t have the Physics ‘obey’ the anchor point settings (whether set in LDX, or in Lua), only the images do.

This led me to test it i native Corona, but i was careless enough not to notice the importance of setting the anchor points first BEFORE adding the physics body.

Cheers

Santi

Not a stupid question.  

Actually, I’d prefer it if precedence didn’t matter for this, but my guess is that would be a pain to implement.

Cheers,

Ed

Well spotted guys, I will include this fix in the next version of LDX.

Thanks for the continued support Alan.  

another classic example of a stopwatch…  the clock “hand” should have Y anchor point somewhere at one end, hence in my example, anchorY = .90.   It works, that is, only the images.  The physics of the clock hand remained center.

physics = require "physics" physics.start() physics.setDrawMode( "hybrid" ) local circle = display.newCircle (200, 100, 150) physics.addBody (circle, "static" ) circle:setFillColor (.5,.5,.5) circle.anchorX = 0.5 circle.anchorY = 0.5 circle.x = display.contentCenterX circle.y = display.contentCenterY local hand = display.newRect( 0, 0, 10, 120 ) physics.addBody (hand, "kinematic" ) hand:setFillColor (1,1,1) hand.anchorX = 0.5 hand.anchorY = 0.90 hand.x = display.contentCenterX hand.y = display.contentCenterY local function rotation() hand.rotation = hand.rotation + 6 end local x = timer.performWithDelay( 1000, rotation, -1 )

have you tried setting the anchors before adding the body?

@roaminggamer,

geez!! i knew it was a stupid question… my bad!     I didnt realize the precedence was that important.  It works!  Thanks.

Now I have to re-direct the issue to Level Director X support.   I use LDX with Physics imported from PE, and I can’t have the Physics ‘obey’ the anchor point settings (whether set in LDX, or in Lua), only the images do.

This led me to test it i native Corona, but i was careless enough not to notice the importance of setting the anchor points first BEFORE adding the physics body.

Cheers

Santi

Not a stupid question.  

Actually, I’d prefer it if precedence didn’t matter for this, but my guess is that would be a pain to implement.

Cheers,

Ed

Well spotted guys, I will include this fix in the next version of LDX.

Thanks for the continued support Alan.