Box Collision for a weapon attached to character mesh

Hello everyone,
I want to make a box collision on the weapon that is held by the character but the weapon is not a static or skeletal mesh. it is built inside the character mesh.
Note: i used Sphere Trace by channel but it is not the best way to detect.
thanks in advance

  1. Open the SkeletalMesh asset.
  2. Navigate to the Physics tab on the main toolbar (top right).
  3. See the bones displayed on the Skeleton Tree tab (left).
  4. Right click a bone and choose Add shape > box.

Note : A simpler approach can be done when generating shapes manually for static meshes as well.

Just asking myself why would you make a sword part of the character mesh? What is your goal? Isn’t it easier to just attach a sword AActor to the hand socket of the character, so that you can define all the logic for the sword on the sword itself?

first of all thanks, please explain more the “Note” part. I told my manager that this is not the best way to setup a sword but he told me that he will give me the character and the weapon as an one skeletal mesh, so it is not my call :slight_smile: .

i think he want this approach because of the animation.

I know about the physics asset but i do not know how to trigger these capsules for collision so can u suggest a link or a course that explain how to do it and thanks in advance.

You could have the sword as a static mesh, added to a blueprint Actor. This way you can use the simple collision of the sword’s static mesh to trigger overlap events on the sword Actor, where overlap logic can be defined for combat as well. This way you don’t mix up logic for the character and the sword, especially for overlap and collision logic.

Could be, or perhaps he does not know you can attach an actor / mesh to another actor. You can make use of sockets which are spots on a character’s bone to which you can attach things. these sockets can have their own transformation offsets relative to the bone, so you could just add a “sword socket” to a hand bone and attach a sword actor to it. Big chance all of the existing animation only requires bones of the the character itself instead of the sword.

Matthew Wattstein also has tutorials for collision on youtube in the “htf do I?” series.