Download

Linetrace by channel not hitting players unless the server character is looking

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.

Along the lines of this…

EDIT …

Full Process

1 Like

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.

Run it with a dedicated server.