Download

Offset Client Line Trace

Hi all,

I have a small project with multiplayer enabled (replication).

I have an issue when trying to use a line trace with multiplayer.

The code is in the ‘ArenaFPSHitscan’ image.

I use the follow camera so I can get a line trace that is at the same place as the centre dot on the player’s screen

It runs on the server just fine, seen in the ‘ServerLineTrace’ image.

However, when I look at the clients as the server. I see that their line traces are offset. Shown in the ‘ClientLineTraceImage’.

This offset is consistent, I can aim wherever as the client but the line trace always comes out of the client at that angle rather than straight.

I run the line trace on the server. I have a local shoot function that does some cosmetic and ammo stuff which calls the server to do the line trace calculations and the appropriate follow up actions such as deal damage (dealing damage works).

The code for handling this is on the 3rd person character blueprint event graph as seen in the ‘ArenaFPSShootLogic’ image.

SRV Shoot is run on the server.

I am unsure why this occurs, I tried changing how I get the line trace position but the offset is still there.

Any help would be greatly appreciated.

Many thanks.