I've decided it's about time I posted about another problem in the forums, so here it is, at the moment I'm working on a game with Box2D, but whenever I tell it to create a polygon, it creates it, but the collisions don't always work right, and when they do, half of the polygon doesn't abide by collisions. So you know I'm using debug draw so I know what's happening on the Box2D side. In addition the polygon's CSV String is "0,-25,22,-3,13,-3,13,24,-14,24,-14,-3,-23,-3,-1,-25". It also always comes up with these annoying error messages multiple times, here's what they look like - Please login to see this link. They come up even though the polygon's coordinates are listed clockwise and the shape is convex. And also I don't know what to do in order to make sure it doesn't "core shape got too small". And also I don't know what the minimum thickness is for shapes, if there is one. So if someone could help me with all this, I would be grateful.

Box2D polygon problems...
A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.
Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!
Clickteam.
-
-
I'm having that issue too. It seems to only work with basic polygon shapes. It doesn't seem to work when you "draw" it inside the objects frame, the error pops up. If you draw along side frame of the object, it works. I';m trying to make a peggle game and I've ran into this issue. Maybe this ext doesn't support full on custom collision.
Please login to see this link.
**The dots are where you would plot he vertices**The one the left will give you error, the one on the right will work just fine. It seems getting complex convex shapes might not work.
-
What's even weirder is I have actually already simplified the design of the shape to make it with those vertices, so even though all my shape is, is pretty much just a square with a triangle on top of it, it still doesn't work...
-
Post an image of the sprite.
Edit, nevermind. Anyway, I got it work with a box that's about 39x40, underneth a triangle that's about 39,19
[0,20],[20,0],[38,20],[38,58],[0,58] -
Wait so which needs to be bigger, the active object you attach to, or the Box2D shape, so I know for sure in case I need to do something like this again?
-
The object I use is this.
Please login to see this link.Put this in the string and see if it works.
Without the brackets.
[0,20],[20,0],[38,20],[38,58],[0,58]
I looked at the example Box2D came with. -
My shape actually looks like this - Please login to see this link. So it has more vertices and is all one shape, in addition the edge chain isn't working for me for some reason, even with simple shapes, and I do have version 1.0.4 of Box2D so I don't see what the problem could be with that.
-
You guys are clearly misunderstanding what a convex shape is. The shape Ethan tried to create in the first post and the first shape on Please login to see this link. image are examples of concave shapes.
Box2D can only work with convex shapes, so if you need to create a body with a non-convex shape you need to split it into multiple convex shapes. Or, if it's a static body, you can use edge chains to make it. Edge chains should not be used for dynamic bodies as they don't have collision with other edge chains.
"0,-25,22,-3,13,-3,13,24,-14,24,-14,-3,-23,-3,-1,-25" can be split into 2 polygons:
"0,-25,22,-3,-23,-3" and "13,-3,13,24,-14,24,-14,-3" -
So, other than splitting a 90 degree curve in 10 ( or any number of parts that be divided into 90), there's no other way to have a complete custom collision?
-
Also, what's the point of the polygon shape creation, if you can only use basic shapes put together to make polygons...
-
Quote from Shin
So, other than splitting a 90 degree curve in 10 ( or any number of parts that be divided into 90), there's no other way to have a complete custom collision?
For a dynamic object this is the only way to make an inverse curve in Box2D, for static objects you can use an edge chain.Quote from EthanAlso, what's the point of the polygon shape creation, if you can only use basic shapes put together to make polygons...
The point of polygon shape creation is to create polygon shapes, I'm not sure what you mean with this statement really. -
But do you know what's going wrong with the edge chain, because it still doesn't work, it's like when the body hits it, it gets sucked into it and off the screen...
-
It seems as if Polygon - Edge chain collision detection doesn't work in Box2D no matter how hard I try, so I'm going to go ahead and use multiple different regular shapes attached to each other instead, but you might want to try to fix that.
-
Did you make the chain in the right order? Chains have to be made clockwise since they are one-sided, if you do it the wrong way things will get sucked into them.
-
I did, "0,0,640,0,640,480,0,480" so yes...
-
The collision would be from the outside of that chain, make it the other way if you want the collision to be on the inside.
-
Ok, thanks
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!