Line trace problem with replication



Hi, so basically im trying to do a Multiplayer FPS, but i have a problem with replication specially with my line trace.

To shoot i create a line trace that start at the middle of the camera, the problem is that on the client screen i see that i shoot where i aim, but not on the server point of view where my line trace is shooting straight forward as you can see in the pictures.
When it comes to apply damage based on the line trace hit, the line trace saw by the server so the straight forward one is the only one that the server take. So if i aime the roof i still touch people because they take the other line trace. Before you ask yes there is only one line trace shot in my blueprint.

Does anyone have an answer to this ? Thank you

1 Like

Can you show the line trace graph?
Most likely you are using a direction/pitch that is only available on the client and not on the server.
Try using ControlRotation as linetrace direction.

1 Like


Here is the image, “Start” is a sphere attach to the camera and placed in the middle of it, so i just take this base to shoot my line trace so the player shoot where he look at. Changing those components to replicate dont solve the problem

1 Like

Yeah the Camera component transform is not replicated to server, regardless of replication settings, so it’s basically following the Character, which has no pitch.

Replace Start.GetForwardVector with GetControlRotation instead.

Thank you bro it worked ! :smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.