Getting primitive collision component(s) from body/bone (Noob question) c++?


Anyone help with my c++ problem as I’m new to Unreal.

I have a Pawn with a skeletal mesh setup with multiple collision primitives on certain bones. I can get the bone in c++ by name, but can’t see a way to get each collision primitive. Any help would be appreciated ?


I was looking for the same thing and I found it. Here is an exaple code:

FBodyInstance* bodyInstance = skeletalMeshComponent->GetBodyInstance(FName(TEXT("foot-R")));
UBodySetup* bs = bodyInstance->GetBodySetup();
for (int i = 0; i < bs->AggGeom.BoxElems.Num(); i++)
{ FKBoxElem& box = bs->AggGeom.BoxElems*;
  if (box.GetName() == FName(TEXT("foot-box-R")))
  [INDENT=2]UE_LOG(LogTemp, Warning, TEXT("Test %f"), box.Z);[/INDENT]