I am unable to perfectly replicate a flashlight pickup in UE5.

Animations replicate fine, but after picking up one of the two pickups placed in the level the action toggles the flashlight on ground. Even in Client 2’s hand.




I’m assuming you mean that when you turn on your flashlight, it turns on the flashlight pickup on the ground instead. I would probably have to see where you set the “PickupFlashlight” variable in the player blueprint in order to figure out whats happening.

Also I would recommend using a line trace by channel from the camera for picking up items like this.

Yeah that’s what’s happening, I will admit I’m still fairly new at this but dedicated to getting it learned and figured out.

And I do appreciate it, and yeah a line trace is definitely my goal for attachment I started to create one but haven’t quite finished it yet, as you said Line Trace by Channel would work better than a Line Trace For Objects here?

Thank you for your time to help me

I think I see the issue. You need to set the “PickupFlashlight” variable after you attach the flashlight to the player’s mesh. Also make sure that the variable is replicated, as we are now setting it on the server.

As for the line traces, line trace by channel will only hit things that block the specified trace channel (default trace channels highlighted in blue below)
Line trace for objects only hits things that block any of the object types you tell it to look for. (default object types highlighted in red below.)
image

It doesn’t matter too much which one you use, as long as the object you want it to hit blocks the specified channel(s). You can also add your own custom trace/object channels in Project settings/Engine/Collision.

Personally I would use a line trace by channel that uses the “visibility” channel. Then make sure that the flashlight pickup in its collision has the visibility channel set to block.