I am using a multiplayer system where players can interact with each other using a line trace by channel (visibility).
When a client character runs the linetrace at the server character, the trace always hits and the interactions goes ahead.
However when a client runs the linetrace on another client character, the trace will only hit if the server character is looking at the two client characters interacting. If the clients aren’t on the servers screen, the trace will just pass right through the collision and no interaction will go ahead.
The linetrace is run on the server.
Is this an expected result? How can I ensure that the linetrace will be blocked and the interactions between clients can go ahead, even if the server character is not looking?
Thanks for your help, this is my first time posting a question on the forums.
Interaction in multiplayer should always be done by the server (Authority).
Client press interact key → Switch has Authority (Remote) → Call Server interact event (runs on server).
Server Interact → Switch has authority (Authority) → Line Trace etc and so forth.
When doing traces from pawn…say camera (common practice) on the server you need to Instead use Controller for rotation → forward vector.
Self (character class ref) → Get controller → get control rotation … Otherwise the end of line trace is nowhere near where you think it is or should be. Pawn cams don’t have rotation on the server. Thus camera → get rotation → forward vector is going to return 0, 0 ,0.
Thanks for the response but I’ve already set it up like this. The line trace is running on the server and I can see with the debug lines that it’s tracing exactly where I want it to. But the problem is that no hit is registering unless the line trace occurs on screen of the server version of the game. I.e. a client player triggers a trace at another client, the trace itself runs on the server, but there is only a hit result if the server player witnesses the trace - otherwise it passes right through the player that should have been impacted.
You need to change the setting in Skeletal Mesh “Visibility based anim tick option” to “always tick pose and refresh bones”. But keep In mind that it is really source-consuming.
After hours and hours of trials and error, thank you! ill save this and apply to my project moving forward. The method of having the client ask the server to do a tracebychannel on its character in the server game instance.