Nope that’s not a bug; Box2D only allows 8-pointed physics shapes, so it’s clipping your shapes off at 8 points. You’ll need to use something like this: http://code.coronalabs.com/code/create-complex-non-convex-bodies
- C
I think it has nothing to do with box2d.
newOutline api should support Auto Traced complex concave shape and convex shape, just like spritehelper. otherwise, It’s a useless api.
[sharedmedia=core:attachments:2796]
You’re right - newOutline has nothing to do with physics. You can use it to vectorize an image, create a hit-test for collision detection, and probably a lot of other things I can’t think of right now. EDIT: It seems CoronaLabs did build newOutline for physics after all - my apologies
Imagine if newOutline, instead of giving you a table of points, instead gave you a table of sets of 8 points, perfectly formed for physics.addBody and sorted according to concave/convex and clockwise/counter-clockwise. It would be perfect for using with physics, but try and use it for anything else, and you’d find yourself having to write a BUNCH of swapping-formats code.
Come to think of it, it wouldn’t be perfect for use with physics. You’d then have to go through each table of points and add your physics parameters. The whole thing would be quite a nightmare, in the end, especially if you wanted to use it for anything other than physics (as in add a physics body to an object based on the shape and trace it with a line).
Instead, the brilliant Corona developers made newOutline return the points in a universal format, then people could write importers (like the link I posted) to use it for all sorts of things.
Most of the time, the Corona developers know best
- C
Hi @pickerel,
The accuracy of the trace can largely depend on the “coarseness” value you set. Sometimes adjusting it even slightly can change the outlined shape that is generated.
Also, just to clarify, this API was designed with physics in mind, primarily, and to be used with physics.addBody(). I’ve seen developers use it for other things, like generating a new vector polygon with the points, but that is not always reliable, depending on the complexity.
Take care,
Brent
I see. We will implement a method to splite the outline shape to triangles ourself.
thanks Caleb & Brent.
Update: If you’re still using this, I just noticed the following in http://docs.coronalabs.com/api/library/physics/addBody.html:
Array. An outline array generated by graphics.newOutline(). outline has fewer restrictions than shape, for example, an outline can be either convex or concave.
So it seems you can save the outline of an object and set it instead of shape.
- Caleb
Nope that’s not a bug; Box2D only allows 8-pointed physics shapes, so it’s clipping your shapes off at 8 points. You’ll need to use something like this: http://code.coronalabs.com/code/create-complex-non-convex-bodies
- C
I think it has nothing to do with box2d.
newOutline api should support Auto Traced complex concave shape and convex shape, just like spritehelper. otherwise, It’s a useless api.
[sharedmedia=core:attachments:2796]
You’re right - newOutline has nothing to do with physics. You can use it to vectorize an image, create a hit-test for collision detection, and probably a lot of other things I can’t think of right now. EDIT: It seems CoronaLabs did build newOutline for physics after all - my apologies
Imagine if newOutline, instead of giving you a table of points, instead gave you a table of sets of 8 points, perfectly formed for physics.addBody and sorted according to concave/convex and clockwise/counter-clockwise. It would be perfect for using with physics, but try and use it for anything else, and you’d find yourself having to write a BUNCH of swapping-formats code.
Come to think of it, it wouldn’t be perfect for use with physics. You’d then have to go through each table of points and add your physics parameters. The whole thing would be quite a nightmare, in the end, especially if you wanted to use it for anything other than physics (as in add a physics body to an object based on the shape and trace it with a line).
Instead, the brilliant Corona developers made newOutline return the points in a universal format, then people could write importers (like the link I posted) to use it for all sorts of things.
Most of the time, the Corona developers know best
- C
Hi @pickerel,
The accuracy of the trace can largely depend on the “coarseness” value you set. Sometimes adjusting it even slightly can change the outlined shape that is generated.
Also, just to clarify, this API was designed with physics in mind, primarily, and to be used with physics.addBody(). I’ve seen developers use it for other things, like generating a new vector polygon with the points, but that is not always reliable, depending on the complexity.
Take care,
Brent
I see. We will implement a method to splite the outline shape to triangles ourself.
thanks Caleb & Brent.
Update: If you’re still using this, I just noticed the following in http://docs.coronalabs.com/api/library/physics/addBody.html:
Array. An outline array generated by graphics.newOutline(). outline has fewer restrictions than shape, for example, an outline can be either convex or concave.
So it seems you can save the outline of an object and set it instead of shape.
- Caleb