Sphere Tracing for Weapon Works only when weapon socket is permanently added to character capsule.

Hello. I’m just beginning and I’ve been following 2 tutorials for weapon tracing for combat. Both used a solution based on attaching the weapon to the character capsule’s mesh (creating a socket inside the capsule’s mesh -


and they then drop weapon inside the socket. Makes it super easy to access in BP.

In my case, I do it trying to reference the object inside skeleton’s hand socket, the weapon in it, and here was when I first encountered a major issue, so the first question is - if the weapon is in the hand socket instead of inside the character capsule’s mesh, how do I properly access that object, and it’s location from the blueprint?

Upon initialization of game I add the weapon to R hand socket callet Weapon_R:

Saving to variable SwordObject, and then I trace it, following top and bot socket on the weapon.

Well, I basically do the same thing that WORKS with the messy solution, but when I reference the sword otherwise as above, it somehow fails.

Anyways, the outcome is unbelievable. Only 1 location is traced, and I have no idea what it is, it’s clearly not the weapon socket, not even 1 of them, because when I moved BOTH sockets to the top of the weapon and done some testing, the same exact result occured… when I changed the names the same below tracing still worked (no idea what it is tracing?) Below is a SS of that occurence.

I need to make it work on the hand socket. There just seems to be no options of doing so?

Help appreciated.

im sure exactly what your saying, but my guess is the sphere is colliding with the owner, you probably want to add both the owner and the sword to actorstoignore array

I tried adding character self reference to array and linked it and it still results in same thing. I’ll try some more with collisions soon, thanks.

There also seems to be a small breakthrough / hint as to what is being traced on last screenshot. So, if I pass the character skeletal mesh to the tracing it traces also a single point and this is the root (beginning?) of the character mesh, so i’s basically a small dot on the ground, between legs of mannequin.

Therefore, I’m guessing on last screenshot it gets the weapon object but doesn’t locate the sockets, so it traces beginning of the weapon skeletal mesh?
If I understand correctly, the object I’m getting is weapon’s blueprint, which uses skeletal mesh and inside SM are the sockets in correct positions & names.

well if the socket fails it’ll return 0,0,0. but to check add some print strings on the result and also the hit result to see what its hitting

super weird result, done this:

  1. the name is 10, not 100.
  2. both socket gets work and return same location

so add the weaponobjectref to the array of actors to ignore

same result =/

LogBlueprintUserMessages: [BP_ThirdPersonCharacter_C_0] BP_SK_Blade_HeroSword100
LogBlueprintUserMessages: [BP_ThirdPersonCharacter_C_0] X=986.188 Y=1108.794 Z=117.459
LogBlueprintUserMessages: [BP_ThirdPersonCharacter_C_0] X=986.188 Y=1108.794 Z=117.459
LogBlueprintUserMessages: [BP_ThirdPersonCharacter_C_0] BP_SK_Blade_HeroSword100
LogBlueprintUserMessages: [BP_ThirdPersonCharacter_C_0] X=986.017 Y=1109.026 Z=117.376
LogBlueprintUserMessages: [BP_ThirdPersonCharacter_C_0] X=986.017 Y=1109.026 Z=117.376

unless something’s wrong here

i notice you’ve replicated it now, if you’re spawning on begin play it’ll be called on client and server, this could explain why its sword100 and not 10. my guess is your colliding with the duplicate. try a switch has auth before the spawning

not sure i understand fully but I’ve added those two things
(if i set remote on the switch it won’t spawn)

it prints out weapon blueprint id 10 but it’s a bit different

how can i access this bp instance explicitly?

because the log for trace later on logs id 100 again and it still can’t work with this setup

print the display name of the hit actor, i thought you were before but thats the weaponref, lets see what if anything its hitting, so remove the cast