Attaching projectile to hit skeletal mesh with animation

Hi
I have an arrow projectile that i fire. when it hits a collision capsule i perform a line trace from the hit location to the mesh. This returns a second hit where the arrow would land and penetrate. I then spawn an arrow at that location, giving the effect of an arrow having been stuck into a character. however this character has animation. in this case an idle animation and as it plays the animation the arrow remains in place and the characters mesh moves through it. I cannot figure out how to stop this happening. i would like for the arrow to also move with the mesh/animation, but dont know how

The character is the third person example and the arrow is a custom bp.
ive used attach to which using the hit location and other reference from the line trace.
Any one know how i can fix this
Thanks

It sounds like you need to attach to the specific bone that has been hit by the trace, not just the mesh itself. Use the BoneName from the hit result when attaching the arrow to the mesh component.

Out of curiosity, is there a reason the arrow has to hit the capsule, and not the mesh itself? If the collision of the projectile just hit the mesh and ignored the capsule, you wouldn’t have to do a secondary trace nor spawn a new arrow. Also a hit on a capsule doesn’t always mean a hit on a mesh, so tracing the mesh directly could be more accurate.

Hi thanks zak
sorry i should have mentioned im using the hit bone name as the socket to attach to. this attaches but when the animation plays the arrow doesnt follow along.

as for the capsule and second trace. i wanted to fire an actual projectile from the crossbow and stick it in when it hits the character. id searched the forums and answerhub and found that per poly collision on a character’s mesh is really expensive and that capsule collision was used instead to make it cheaper. so i started thinking that since the arrow is colliding with the capsule and if i used a line trace, the resulting hit would be accurate. you’re right, theres times when it doesnt work. like the arms being outside of the capsule or because the capsule has empty spaces but for that i can use a branch node. i could also just move the arrow to the traces hit location but im new to game development and was testing out the functionality when i noticed that my projectiles were auto destroyed some time after firing them. so i simply spawned a new one that hadnt been fired and wouldnt auto destroy some time later.

How would i do what you say and make the arrow ignore the collision capsule and hit the mesh or should i open a seprate thread for that.

I’m not sure why animation wouldn’t move the attached arrow, it should as long as the animation is updating the bone locations.

To make the arrow ignore the player capsule and hit the mesh, you need to adjust the collision response in the profile of the arrow. You want to ignore or overlap “Pawn” and have it block “CharacterMesh” (or whatever the mesh is using) and make sure the character mesh blocks the arrow collision channel type.

You shouldn’t need per-poly collision necessarily, if the mesh has a physics asset with various shapes that are pretty accurate to the mesh bodies.

If the arrow is being destroyed after some time, you probably want to change the actor lifetime when it’s stuck in a player to be much longer.

hi thanks ill make these changes. it would make things so much simpler.
however the arrow still doesnt move with the animation. it seems that it might be because the character is being attached to the arrow so in the world outliner its arrow → thirdpersoncharacter. This seems to be because im attaching the objects the wrong way however im having issues swapping the target and parent in attach to around. its because i need a scene component reference and i have an actor.

unfortunately that wasnt it. i thought that changing the order would fix it but it doesnt.
i can eject in pie and move the character around. The arrow follows with the move and i can also individually move the arrow but it still doesnt move the arrow with the animation

finally ive done it. it turns out that i needed to cast to the hit character and get is mesh then attach the arrow to that. instead of casting to the hit character casting to the base character blueprint class and attaching to its mesh works for all child classes

Thought id answer this here for anyone else with the same problem.
it turns out that i needed to cast to the hit character and get is mesh then attach the arrow to that. instead of casting to the hit character casting to the base character blueprint class and attaching to its mesh works for all child classes

Solution - you need to attach arrow to mesh bone only in mesh actor (mesh hit/overlap event) NOT in arrow actor. Thanks to all people in this forum! Together we fix any issue.