Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

png2box2d is fantastic! Thank you!
Started by Icy Spark Jan 17 2014 01:36 AM

8 replies to this topic
png2box2d physics addbody
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Icy Spark

[GLOBAL: userInfoPane.html]
Icy Spark
  • Pro
  • PipPipPipPipPipPip
  • 234 posts
  • Jedi

So I had a little play with the Png2Box2D sample code.  Love it.  Has so many possibilities. 

 

Just one question though (from the sample):

 

What does the 2 represent in the following code and what if any limits are imposed on this number?

 

local image_name = "star.png"
local image_outline = graphics.newOutline( 2, image_name )

 

Thank you.



[TOPIC: post.html]
#2

Brent Sorrentino

[GLOBAL: userInfoPane.html]
Brent Sorrentino
  • Corona Staff
  • 3,515 posts
  • Jedi

Hi @Icy Spark,

Good to hear that you like it! Let us know if you find any quirks with it.

 

In the documentation here...

http://docs.coronalabs.com/daily/api/library/graphics/newOutline.html

 

… the "2" (first argument) is the "coarseness in texels". Essentially, the lower the number, the more accurate the trace, but also (in most cases) the more complex of a body structure for physics. So, it's really up to you to determine which value fits best and gives you the best balance between trace accuracy and collision detail.

 

Hope this helps,

Brent



[TOPIC: post.html]
#3

GamingStudio17

[GLOBAL: userInfoPane.html]
GamingStudio17
  • Pro
  • PipPipPipPipPipPip
  • 114 posts
  • Jedi

Thank you very much! And you can use this feature to create physics polygon or group object?



[TOPIC: post.html]
#4

Brent Sorrentino

[GLOBAL: userInfoPane.html]
Brent Sorrentino
  • Corona Staff
  • 3,515 posts
  • Jedi

Yes, it should work fine for a PNG polygon. :)

 

What do you mean by a "group object" though?

 

Brent



[TOPIC: post.html]
#5

GamingStudio17

[GLOBAL: userInfoPane.html]
GamingStudio17
  • Pro
  • PipPipPipPipPipPip
  • 114 posts
  • Jedi

Yes, it should work fine for a PNG polygon. :)

 

What do you mean by a "group object" though?

 

Brent

display.newGroup()



[TOPIC: post.html]
#6

bragbase

[GLOBAL: userInfoPane.html]
bragbase
  • Starter
  • Pip
  • 7 posts
  • Newbie

When will newOutline be available / included in the public build?



[TOPIC: post.html]
#7

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Corona Staff
  • 7,094 posts
  • Jedi

We don't have a planned date to do our next public release.  I'll have to ask if this feature will be considered a premium graphics feature or if it will be available to starters.

 

Edit:  This is a premium graphics feature that you would need to be Pro or Enterprise to access.

 

Rob



[TOPIC: post.html]
#8

Icy Spark

[GLOBAL: userInfoPane.html]
Icy Spark
  • Pro
  • PipPipPipPipPipPip
  • 234 posts
  • Jedi

Was just going to post a bug where image scaling for @4x images wouldn't work, but I see it's been fixed in 2014.2174 (hopefully).  Was tearing my hair our for a few hours earlier.  Will need to give the new update a try.



[TOPIC: post.html]
#9

ksan

[GLOBAL: userInfoPane.html]
ksan
  • Pro
  • PipPipPipPipPipPip
  • 2,179 posts
  • Jedi

It seems to work well on this end. Just make sure your images have crisp clean borders in the transition to transparent section. 




[topic_controls]
[/topic_controls]



Also tagged with one or more of these keywords: png2box2d, physics, addbody