Hello,
for the past two days, following the API and the docs. I have been trying to make this:
into a concave physics body. I am aware that, unless I want to use AutoPolygon, that I need to use
BODYNAME = PhysicsBody::createPolygon(
So after following the api I finished with this:
physicbound = PhysicsBody::createPolygon(
(
Point(0, 3),
Point(3, 60),
Point(6, 50),
Point(9, 30),
Point(12, 40),
Point(15, 20),
6,
PhysicsMaterial(PHYSICSSHAPE_MATERIAL_DEFAULT),
));
the points used are only for testing, to see if it works
and now I’m obviously aware this is not the way to go. So I ask, how does one create a concave polygon physics body?
From reading posts I respect and actually encourage how people here tend to go over the error by starting with basic insights but can I please get a straight forward answer, I am very stressed from trying to achieve this for TWO days straight, and just want to get it over with and proceed.
This is the only easy option, Use Physics Editor tool.
So I have made this:
and began with this:
for (int i = 0; i < 1; ++i)
{
physicsBody3 = PhysicsBody::create();
PhysicsMaterial(1.9f, 0.1f, 9.4f));
DEL1basket = Sprite::create("BASKET.png");
DEL1basket->addChild(physicsBody3);
DEL1basket->setPosition(Point(400, 600));
addChild(DEL1basket);
}
What do I set the body as? Again sorry if I’m being pushy, I just want to get this over with
You need to use PhysicsShapeCache class from that tool to load physics-body.
You should check their documents/tutorials for this, its very simple.
i am using this .h
http://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml
example
//get points polyline
ValueVector pts = it->second.asValueVector();
//pushing point in vector
//Im set namespace Tr
Tr::Vector2dVector polyline;
for (auto &&point : pts)
{
auto x = point.asValueMap().at("x").asFloat();
auto y = point.asValueMap().at("y").asFloat();
polyline.emplace_back(Tr::Vector2d(x,-y));
}
//Triangulate concave polygons
Tr::Vector2dVector result;
Tr::Triangulate::Process(polyline, result);
//Chek size
int size = result.size();
int trigleCount = size > 0 ? size / 3 : 0;
//push tringle to shapes pull
std::vector<PhysicsShapePolygon*> shapes;
for (int i = 0; i < trigleCount; ++i)
{
Vec2 *vert = new Vec2[3];
for (int t = 0; t < 3; ++t)
{
auto p = result[i * 3 + t];
vert[t] = Vec2(p.GetX(), p.GetY());
}
shapes.push_back(PhysicsShapePolygon::create(vert, 3));
}
body = PhysicsBody::create();
//insert shapes in body
for (auto &&shape : shapes)
{
body->addShape(shape);
}

how to remove artifacts when debugging - I do not know 
There are different types of polygon optimization in the “godot”. In the cocos2d they are missing.