I’m trying to create a compound shape with SetCustomConvexHull().
What happens is as if all the vertices are combined into a single mesh, and I get a single convex hull.
// Create a collision shape for each shape, resulting compound collision
for (const auto& shape : shapes)
{
// Get the shape's geometry
auto collisionGeometry = node->CreateComponent<CustomGeometry>(LOCAL);
for (const auto& vertex : shape.vertices)
{
Vector3 position(vertex.x, vertex.y, vertex.z);
collisionGeometry->DefineVertex(position / scale);
}
// Create a collision shape
auto collisionShape = node->CreateComponent<CollisionShape>(LOCAL);
collisionShape->SetCustomConvexHull(collisionGeometry);
}
If I use SetPrimitive or SetConvexHull, it does work as expected, creating seperate shapes.
Is it a bug with SetCustomConvexHull()?
Does a node can have only a single CustomGeometry component?