Announcement

Collapse
No announcement yet.

Getting physics asset shape name from collision

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Getting physics asset shape name from collision

    Keeping it short, I need to find the name of the PhAT asset's shape that registered the collision for locational damage purposes. I can get the bone name easily from a FHitResult of course, but I seem to not be able to find the way to get the actual shape attached to said bone. USkinnedMesh::GetPhysicsAsset() is as far as I get, but after that I'm stumped, there does not seem to be any clear way to get the shape nor its name. PhAT shapes are easy to rename in editor so we'd much prefer to use them for determining the hit location than bone names.

    I imagine I'm just missing something or it's not named clearly, constraints and just about any other info seems easy to fetch, so it feels like this should be too.

    #2
    Found it. In case anyone finds this looking for the answer as well, what you want is SkeletalMeshComponent->GetBodyInstance(FName BoneName)->BodySetup->AggGeom. Inside AggGeom there are several arrays for each type of shape, so you'll have to check them for their name, as far as I know there's no other way.

    I noticed that this was kinda answered in https://answers.unrealengine.com/que...tives-fro.html only after finding this out, but it's not quite the same. For a static mesh it seems you can just get the body setup, while a skeletal mesh has body instances on each bone, and in my case I needed to get a specific bone instance for the collision (which GetBodyInstance() allows you to do).

    Comment

    Working...
    X