Skeletal mesh overlap returns null bone
Steps to reproduce:
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?
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:
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.
answered Sep 27 '16 at 03:46 PM
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:
In Begin Play:
Create function in your pawn:
In your overlap event:
answered Sep 11 '18 at 05:39 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here