Hi,
[ b2.PolygonShape ]I am currently using b2.PolygonShape to detect collisions on my objects.
[ b2.ChainShape ]I am using b2.ChainShape to create world boundaries.
See :
[ Objective ]I would like to merge a few classes, and would like to know if :
- Could b2.ChainShape be an alternative to b2.PolygonShape or are they fundamentally different?
Can I replace PolygonShape with ChainShape (for squared collision boxes) and expect my collisions to be detected the same way?
- Other than world boundaries, what would have been the purpose of ChainShape in the first place?
I never thought chain shape could be used like this (commenting on creating world boundaries)
ps : sorry, I know I ask a lot of questions. Hopefully you won't see me that often here in the future.
Comments
Have a look at this i think it will answer all questions
http://www.box2d.org/manual.html
[edit :- jump to section 4]
Likes: Mells
If you create a body with ChainShape and make it dynamic, it won't behave well.
It probably won't rotate, and there will be no collisions with other chainshapes (they are not defined in box2d).
So ChainShapes are meant for static bodies only.
What I think @atilim was actually referring to (not that chainshape can be used for world boundries), but that it is possible to encapsulate whole world within the bounds of the one chainshape. It might not feel natural to do that, but it is completely legit to use one chainshape as the box that include (surrounds) the world and elements.
thank you for the link, that was helpful.
@ar2rsawseen
I get it now, that was a good explanation.
I change it to *answered*