Is graphics.newOutline() no longer available?

Hello!

I have the following code that was copied and pasted from https://docs.coronalabs.com/api/library/physics/addBody.html#outline-body-1. I added the physics library, started it, and set it to hybrid. However, I’m getting an error of  ERROR: main.lua:20: physics.addBody() : invalid “outline” in the console. Is the outline option no longer available?

I’ve attached a screenshot of the app and the code I’m using is pasted below.

local physics = require( "physics" ) physics.start() physics.setDrawMode( "hybrid" ) local image\_name = "star.png" local image\_outline = graphics.newOutline( 1, image\_name ) local image\_star = display.newImageRect( image\_name, 130, 130 )   image\_star.y = 200   image\_star.x = 200 physics.addBody( image\_star, {outline = image\_outline} )

Hi @thatssopanda,

We didn’t remove that API. Did you try another image just for testing? Perhaps it’s not able to generate the proper outline for it?

Brent

When you say you ‘copied and pasted’ the example, I assume in addition to this you provided an image called ‘star.png’?

I’m attaching the star image I used for this. In this case, it’s a png graphic that I found on Google. I meant to attach it with the previous post, but all I did was choose the file without clicking on attach this file.

I’m also sending a screenshot of what I see in the app with the star.

@BrentSorrentino I tried another png graphic, a panda head, and no luck with that either. 

I’m using the latest public build - Version 2017.3135 (2017.9.7).

Hi @thatssopanda,

I did some testing and there appears to be something amiss. I reported it to engineering but I’m not sure when (or if) it will be fixed. TBH, this API has always been a bit fussy and buggy, so I honestly can’t advise that you use it… it might take a bit longer to create your physics body vertices as specific defined tables, but you’ll get exactly what you expect by doing so, no guess work or surprises.

Best regards,

Brent

@Brent, thanks for the heads up. It’s too bad that it’s not working anymore. I used this a few times before and it’s always been a huge time saver. Do you have anything you can suggest to draw the physics body outline without having to do it by hand? 

@thatssopanda,

Yeah, sorry about that… engineering is investigating, so you could wait for a potential fix, but if you need it “now” then I suggest you create the bodies manually.

Not sure how much you mean with “by hand”… Scott Harrison’s plugin here certainly makes it easier to create the bodies, and it’s free:

https://marketplace.coronalabs.com/plugin/physics-body-editor

Brent

Another option to consider is using Level Director X, which I use for all my projects, this allows you to draw physic boides or autotrace.

Hello!

I had never tried this API. Today I did a test is actually with some bodies running and with others no. That’s a shame, that would be very useful for me.

Is there a hope that it will be permanently updated? Or is not one of the “things planned”?

The api was awesome when it was working, but I ended up using a combo of TexturePacker and PhysicsEditor to create custom sprite bodies. They are available on codeandweb.com.

thank you @thatssopanda

That’s exactly what I do now. But if the API were definitively adjusted it would be a big thing.

A long time spared…

Hi @thatssopanda,

We didn’t remove that API. Did you try another image just for testing? Perhaps it’s not able to generate the proper outline for it?

Brent

When you say you ‘copied and pasted’ the example, I assume in addition to this you provided an image called ‘star.png’?

I’m attaching the star image I used for this. In this case, it’s a png graphic that I found on Google. I meant to attach it with the previous post, but all I did was choose the file without clicking on attach this file.

I’m also sending a screenshot of what I see in the app with the star.

@BrentSorrentino I tried another png graphic, a panda head, and no luck with that either. 

I’m using the latest public build - Version 2017.3135 (2017.9.7).

Hi @thatssopanda,

I did some testing and there appears to be something amiss. I reported it to engineering but I’m not sure when (or if) it will be fixed. TBH, this API has always been a bit fussy and buggy, so I honestly can’t advise that you use it… it might take a bit longer to create your physics body vertices as specific defined tables, but you’ll get exactly what you expect by doing so, no guess work or surprises.

Best regards,

Brent

@Brent, thanks for the heads up. It’s too bad that it’s not working anymore. I used this a few times before and it’s always been a huge time saver. Do you have anything you can suggest to draw the physics body outline without having to do it by hand? 

@thatssopanda,

Yeah, sorry about that… engineering is investigating, so you could wait for a potential fix, but if you need it “now” then I suggest you create the bodies manually.

Not sure how much you mean with “by hand”… Scott Harrison’s plugin here certainly makes it easier to create the bodies, and it’s free:

https://marketplace.coronalabs.com/plugin/physics-body-editor

Brent

Another option to consider is using Level Director X, which I use for all my projects, this allows you to draw physic boides or autotrace.