Pre-scaling and Physics Bodies

Read First

Before I ask my question, let me state that I am aware that scaling an object AFTER you add a physics body, will not scale the body.  In fact, you cannot scale bodies at all.

The Question

My question is, “Has there been a change recently that affects scaling before adding the body?”

For some reason I recall this working in the past:

local tmp = display.newCircle( 0, 0, 100 ) tmp.xScale = 0.5 tmp.yScale = 0.5 physics.addBody( tmp )

i.e. I though this was equivalent to this:

local tmp = display.newCircle( 0, 0, 50 ) physics.addBody( tmp )

I just noticed this is not true in 2015.2669.  Now, when I add a body AFTER scaling,  I get a body that is the full size of the un-scaled object. 

Thanks,

Ed 

Hi Ed,

I never scaled bodies (for physics) either before or after applying the body, so I can’t vouch for what “once worked or didn’t”. Can you clearly prove that something changed between #2669 and previous builds? I don’t believe that the engineers didn’t have any reason to touch the physics library recently, but if you can show that something changed, I can confirm whether anything changed.

Brent

@Brent,

I’ll dig back to an older version.  I don’t mix scaling with physics very often either, so I really can’t be sure whether I’m mis-remembering.

Again, I’ll do back a ways and give it a go.

Cheers,

Ed

You’re probably misremembering. A few years back, I had the same issue. I scaled the object BEFORE I added a physics body to it. Unfortunately, the physics body did not reflect the change in scale. Instead, I had to manually scale the physics body using the shape parameter.

Here’s the link: https://forums.coronalabs.com/topic/35800-auto-change-the-physics-of-an-object-after-a-change-of-his-size/

Hi Ed,

I never scaled bodies (for physics) either before or after applying the body, so I can’t vouch for what “once worked or didn’t”. Can you clearly prove that something changed between #2669 and previous builds? I don’t believe that the engineers didn’t have any reason to touch the physics library recently, but if you can show that something changed, I can confirm whether anything changed.

Brent

@Brent,

I’ll dig back to an older version.  I don’t mix scaling with physics very often either, so I really can’t be sure whether I’m mis-remembering.

Again, I’ll do back a ways and give it a go.

Cheers,

Ed

You’re probably misremembering. A few years back, I had the same issue. I scaled the object BEFORE I added a physics body to it. Unfortunately, the physics body did not reflect the change in scale. Instead, I had to manually scale the physics body using the shape parameter.

Here’s the link: https://forums.coronalabs.com/topic/35800-auto-change-the-physics-of-an-object-after-a-change-of-his-size/