How to use the auto-trace for Corona Physics Library?

I recently decided to try out the auto-trace functionality on Corona’s physics library and I have a question. I used a transparent PNG image, and tried to have it auto-traced, but this message was printed into the logs:

[lua] ERROR: /Users/Alex/Desktop/Corona Physics Library Tests/level1.lua:69: physics.addBody() : invalid “outline” [/lua]

It said something about non-transparent alpha values, can someone explain to me the qualifications needed for an image, for the outline to come out correctly?

Edit: I don’t think there is error in my code:

[lua] local imageFile = “stadium.png”

local imageOutline = graphics.newOutline(2, imageFile)

local image = display.newImageRect(imageFile, 620, 369)

image.x, image.y = 300, -240

image.rotation = 90

physics.addBody(image, “dynamic”, {outline = imageOutline, bounce=0.5, friction=0.1}) [/lua]

Also, here is the image I was using: 

Do the non-transparent alpha values include the background, the actual image, or both? Please respond to both questions if you can.

It considers all of the transparent regions. What do you want to be considered a body element in your image? Every little “dash” along the “r” and “a” labels? Those labels too? The lines inside? Or just the “pill” shape surrounding it?

Best regards,

Brent

Just the physics for the pill shape.

The entire inside of the image is transparent too. This means the API is trying to trace every tiny aspect/outline of the image, not just the surrounding pill shape. Considering its complexity, that may be why it’s throwing an error.

My advice, for now, is to avoid using the newOutline() call and auto-tracing. We’re finding that it’s unreliable and we want to explore either fixing it or deprecating it. In any case, for this shape, you’d be better off just creating a pill-shaped body manually or using a tracing program like PhysicsEditor or the Physics Body Editor plugin.

Best regards,

Brent

Also, here is the image I was using: 

Do the non-transparent alpha values include the background, the actual image, or both? Please respond to both questions if you can.

It considers all of the transparent regions. What do you want to be considered a body element in your image? Every little “dash” along the “r” and “a” labels? Those labels too? The lines inside? Or just the “pill” shape surrounding it?

Best regards,

Brent

Just the physics for the pill shape.

The entire inside of the image is transparent too. This means the API is trying to trace every tiny aspect/outline of the image, not just the surrounding pill shape. Considering its complexity, that may be why it’s throwing an error.

My advice, for now, is to avoid using the newOutline() call and auto-tracing. We’re finding that it’s unreliable and we want to explore either fixing it or deprecating it. In any case, for this shape, you’d be better off just creating a pill-shaped body manually or using a tracing program like PhysicsEditor or the Physics Body Editor plugin.

Best regards,

Brent