Line Trace and Camera Replication

I am doing a simple line trace from the muzzle socket of a rifle skeletal mesh to the center of screen using the camera’s forward vector. The line trace is replicated and runs on the server. Everything works great except that when I run the event from a client, the server shows the line trace hitting somewhere other than where the client is aiming. For example if the client aims at another player’s chest the line trace on the server actually hits the shoulder or the belly. Do I need to replicate the camera or spring arm somehow? I ticked component replicates for both, but nothing changes.

For the server you need to use Get Control Rotation to give you the correct forward vector. Can’t use camera on the server.

image

Thank you! Is there something I should use instead of the camera location for the end trace as well?

Start should be the Cameras Location.
End should be just like you have it.

The result puts the shot through the center of screen.

So take the Hit result (Break), then Impact Location → Select Vector.
Use trace end for B pin.
Blocking Hit → Select A

Then for the actual “Firing” trace use Muzzle (Start) and the Select Vector result (END).

Done.

Regardless of the weapons orientation… where the muzzle is actually pointing in the 3D space. We want the shot to “ALWAYS” go center of screen through the crosshairs.

The above will produce those results.

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