Sword Collision

Most of the Pargaon character models also include the sword as a part of the character mesh. I would think that the sword should normally be its own independent mesh that you create an actor for and then attach to the hand via a socket. Then you could check if the sword actor overlaps with any other actors to determine what the player is hitting.

What is a good way to determine what the player hits when the sword is already attached to the character mesh?

Nothing is stopping you from attaching a collision volume to the sword socket and use that for hit detection :slight_smile:

As Evigmae suggested, you would attach either box components or capsule components to the character mesh on the sockets where the weapons are. Then you would use On Component Begin Overlap ( If you are doing this in c++ you need to use:

void functionname(UPrimitiveComponent * OverlappedComp, AActor * OtherActor, UPrimitiveComponent * OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult);
You would also need to add in your constructor:
ComponentName->OnComponentBeginOverlap.AddDynmic(this, MyClass::functionname) ).

If you need to return specific components you would also use a shape trace (box trace or capsule trace in BP). Additionally, you would need to make an AActor array and include in your code that if the array does not contain the OtherActor, then add the OtherActor to the array and THEN do your effect (like using the ApplyPointDamage function).