Intersecting shapes in multi-element bodies

Corona require that polygon have at most 8

Why don’t you using chain body? I have tested chain body from hundreds (more than 600) vertices and this worked fine.


You need to break this type of body only if you need to simulate legs and arms apart from body i.e. make them moving but keep them physics applied


In attachment body 720 vertices

I have never use multi-element bodies before so I thought this is the only way.  What is difference between multi-element body and chain body?

Thanks for your time to prepare simple project for me:)

There is difference. You can make concave chain body hollow inside. Polygon body, as I remember, must be 8 vertices max, convex and you cannot use inner space.

Maybe polygon bodies are faster, because there is no additional load on engine to count inner space and concave spaces. But really, if you have few bodies with only ten/twenty/thirty vertices running on phones better than i.e. Samsung Galaxy S1 this is irrelevant.

Depends on situation. If you need ease of use + possibility to create convex bodies/spline bodies/arcs/extremely complicated bodies assembled from array of lines with possibility to change it’s shape + extremely perverted inconceivable modifications  -> body created using chains is your choice. But if you need to create simplest convex body that maybe will be cloned in amount of thousands on worst 2000’s device -> use simple shape forms.

Other example: I need to create thousand different body shapes from pictures where shapes will surely have more than 8 vertices, will be maybe convex and maube concave and maybe with usefull inner space. Because I’m beginner with Lua, I will open new project in MS Visual Basic and will write program (.NET version can open png with alpha channel) to easily get array of bits of image, loop through it’s mask to identify key points (future vertices) and to output generated Lua-style or json code for an array of shape vertices that is ready to use in Corona. Last thing is to drop all these thousand images on this programm to get thousand ready to use shapes.


Thanks for your time to prepare simple project for me:)

Offtopic: Corona is ONE and ONLY tool that is working from box without additional dancing with drum. It’s simply working and have many examples. 

Gideros doesn’t compile programs and after two hours of anguish I couldn’t get it to work

LOVE is something strange and not working properly from box and not so simple as it wants to look like.

UNITY is very simple only on first look of youtube overviewers but too hard to make something if you are lower grade than highly-trained professional, realy, you will loose yourself in two lines of code.

That’s why we are looking walkarounds instead of simply changing tool )) 

@zombiexp2010  I like your method for getting an array of vertices.  

I use chain bodies for landscapes and large physics bodies but I’ve never used them for small bodies like balls or characters.  Have you used them for small physics bodies and, if so, have you encountered any collision detection problems when they are moving fast?

Have you used them for small physics bodies and, if so, have you encountered any collision detection problems when they are moving fast?

Yes, sometimes. Solution is to add one more shape to the body with +1 pixel larger. It’s looks like you are extruding shape from inner to outer by +1 pixel.

Also, I haven’t encountered performance issues because, as I said, if you want to create thousands of extra fast bodies you need to use another type of shape, so for few bodies with resulting count (with « extruded shell») about 30 vertices per body this is not important. Much more important sometimes is ease of use with another programs that give you only points so if you want to use combined bodies you need to do a lot of work (break polygons, create clockwise trajectory for points and so on…)

Hmmm, but I have encountered this bug even with simple polygons:

rect+poly with bug https://www.youtube.com/watch?v=1JKBJJx8wLE

and  sphere without https://www.youtube.com/watch?v=KtzlqIoqpT4

so…

As you see, I don’t want to use object:applyLinearImpulse because when char will climb on a hill he will lose in speed. Only direct x-coordinate handling (((

Oh, if you are searching good shape for use with character and to have proper physics, look:

1.Proper rotation angle while standing on the ground - one of chalenges for proper shape

  1. Fast moving without collision bugs

  2. Without holes between tiles like in ponywolf loader

@zombiexp2010

Cool, I’ll take a look, thanks!