I need a way to read the AABB bounds of a mesh’s collision, but all the bounds-related functions I found return the render mesh bounds. Is there a way to get only the collision bounds?
Hi pedro_clericuzzi
Can you achieve what you need with
MyPrimitiveComponent->GetCollisionShape().GetExtent();
This would return you a FVector based on this :
FVector GetExtent() const
{
switch(ShapeType)
{
case ECollisionShape::Box:
{
return FVector(Box.HalfExtentX, Box.HalfExtentY, Box.HalfExtentZ);
}
case ECollisionShape::Sphere:
{
return FVector(Sphere.Radius, Sphere.Radius, Sphere.Radius);
}
case ECollisionShape::Capsule:
{
// @Todo check height? It didn't check before, so I'm keeping this way for time being
return FVector(Capsule.Radius, Capsule.Radius, Capsule.HalfHeight);
}
}
return FVector::ZeroVector;
}
Hope this helps
I tried that but I got the a bounding box as big as the render mesh. I’m trying this with a mesh that has a much smaller box collision set in Maya. The collision shows fine in the mesh editor. Anyway, I moved to a different approach using a BoxComponent’s bounding box, thanks!