x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Skeletal mesh overlap returns null bone

Steps to reproduce:

  1. Make a character with a skeletal mesh

  2. Make the skeletal mesh overlappable with pawn object type

  3. Tick Generate Overlap Events for the skeletal mesh

  4. Add logic to print bone name for on component overlap for the skeletal mesh

  5. Drag a copy of the character into the map

  6. Use the character in your game mode and play

  7. Overlap other character mesh

  8. bone name prints none

I understand that when mesh overlaps with the capsule the bone name is none. However , it also overlaps the skeletal mesh inside the capsule so there is no reason to not have a bone name.

Whats more disturbing is even the location and impact point return zero vector. As such how would you proceed on making a game where its important to know which bone of your character hit which bone of other character?

Product Version: UE 4.13
Tags:
more ▼

asked Sep 18 '16 at 04:01 PM in Bug Reports

avatar image

Commander Shepard
797 62 82 219

avatar image Matt.Williams Sep 21 '16 at 05:24 PM

Hey Commander Shepard,

Can you show me your BP graph?

-Matt W.

avatar image Commander Shepard Sep 21 '16 at 05:49 PM

alt text

avatar image Commander Shepard Sep 21 '16 at 05:49 PM

alt text

avatar image Commander Shepard Sep 21 '16 at 05:50 PM

both overlapping characters are same class

avatar image Machina.Widmo STAFF Sep 23 '16 at 11:57 PM

Commander Shepard,

I will be taking a look into this issue early next week.

Thanks, Jon N.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Command Shepard,

Component overlaps are determined using PhysX sweeps. PhysX doesn't inherently know about Bone Names, but FBodyInstance (which is the user data we pass through) has the notion of Item Indices. On skeletal meshes, these map directly to bones.

So, what you should be doing is something like this:

alt text

Additionally, in order for ItemIndex / OtherBodyIndex to be properly set, you'll need to have bMultiBodyOverlap enabled on the other component. So, in the example project you uploaded, you need it enabled for NewBlueprint's SkeletalMesh component, but not for ThirdPersonCharacter.

Finally, this will cause each bone to generate overlap events as they are each considered their own physics body. This means that as you run through the skeletal mesh with the cube you'll notice several events occurring (one for each bone) as opposed to the single event you currently see. If you need bone information, you'll have to manually filter and ignore these events (something like checking to see if you're already overlapping the given actor, and not performing the begin overlap if you are).

Thanks, Jon N.

overlaps.png (115.4 kB)
more ▼

answered Sep 27 '16 at 03:46 PM

avatar image

Machina.Widmo STAFF
179 4 4 6

avatar image Commander Shepard Sep 29 '16 at 01:34 PM

alright , I'll give it a trial

avatar image Commander Shepard Oct 05 '16 at 11:35 AM

It worked, thanks for your time Machina and Matt

avatar image FlossFarmer Jun 08 '18 at 02:19 AM

I'm on 4.19 and this solution is not working for me. For some reason, the bones indexes seem to be scrambled. In particular, when I hit the head area with a projectile (static mesh), the overlap reports that "pinky_01_l" was overlapped.

I'm using the Third Person SK.

avatar image BladeMaster Jun 30 '18 at 12:08 AM

Bumping this. Same thing is happening for me in 4.19. Any solutions yet?

avatar image Jake1337 Jul 18 '18 at 12:53 PM

Same here - suggested solution not working properly for 4.19.

I've done some counting and what I've found is that the OtherBodyIndex returned by the overlap event does not account for all bones, but rather only bones that have a PhysicsBody attached to them, while the GetBoneName goes over the entire hierarchy and does not skip bones that do not have a PhysicsBody.

It just seems both functions count the index in a different way, knowing this it is at least possible to guess up manually determine up front what OtherBodyIndex translates into which BoneName - this of course is a very (very!) temporary workaround and should be fixed.

avatar image FlossFarmer Jul 18 '18 at 02:38 PM

but rather only bones that have a PhysicsBody attached to them

Yes, this was my conclusion as well when I had this problem.

I tried looking through the source to determine how this was being used and unfortunately did not have good results -- I think the variable was an int32 called BodyIndex or ItemIndex and for me was very hard to understand its use.

Does this problem persist in 4.18 or 4.20? Perhaps a bug report should be submitted.

avatar image Jake1337 Jul 25 '18 at 09:18 AM

Yes it does persist in 4.18 and 4.19 Have not checked 4.20 yet

avatar image 6r0m Feb 12 '19 at 06:56 AM

4.20 wrong body indexes confirmed)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

It seams that the bone name index has the same order of GetBoneNames() method, so I write a function to find all bone name with physic asserts, and use this array, you can get the currect bone name by OtherBodyIndex in ComponentOverlapBegin event. 1. Create a TArray PhysicBoneNames in my character(Or any actor owns the SkeletalMeshComponent). 2. Add a function GetBoneName(float BodyIndex) to return bone name in PhysicBoneNames array . 3. Call this method on your OnComponentOverlapBegin Event.

In Header file:

TArray PhysicBoneNames;

In Begin Play:

     USkeletalMeshComponent* SkelMeshComp = Cast<USkeletalMeshComponent>(GetMesh());
         if (SkelMeshComp) {
             TArray<FName> BoneNames;
             SkelMeshComp->GetBoneNames(BoneNames);
             for (int i = 0; i < BoneNames.Num(); i++) {
                 FBodyInstance* BodyInst = SkelMeshComp->GetBodyInstance(BoneNames[i]);
                 if (BodyInst) {
                     UPhysicalMaterial* PM = BodyInst->GetSimplePhysicalMaterial();
                     EPhysicalSurface SurfaceType = UPhysicalMaterial::DetermineSurfaceType(PM);
                     if (SurfaceType_Default != SurfaceType) {
                         PhysicBoneNames.Add(BoneNames[i]);
                     }
                 }
             }
         }
 }

Create function in your pawn:

   FName AArCharacter::GetBoneName(float BoneIndex)
     {
         if (BoneIndex >= PhysicBoneNames.Num()) {
             UE_LOG(LogTemp, Error, TEXT("Bone index out of bound."));
             return "None";
         }
         else {
             return PhysicBoneNames[BoneIndex];
         }
     }

In your overlap event:

     AArCharacter* OtherCharacter = Cast<AArCharacter>(OtherActor);
     if (OtherCharacter) {
         if (OtherComp) {
             USkeletalMeshComponent* SkelMesh = Cast<USkeletalMeshComponent>(OtherComp);
             if (SkelMesh) {
                 FName BoneName = OtherCharacter->GetBoneName(OtherBodyIndex);
             }
         }
     }
more ▼

answered Sep 11 '18 at 05:39 AM

avatar image

SimplestWay
34 1 3 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question