Line trace always horizontal on client

Maybe it’s the camera you call. Is it attached to your character? Try getting the camera from char if it is.

So this problem is bothering me these days…
I’m trying to implement a basic melee attack using line trace, if the trace hits an object it will apply damage to the object.

On the server side, line traces always follow the direction the player’s camera is looking at…No problem at all, so if the player (as the listen server) is aiming down at the ground and attack the hit object would be the floor, that’s nice.

But on the client, no matter what direction I aim at the line traces would always be calculated by the server as horizontal lines, being that even if I stand in front of a character and aim at the ground and press attack, the hit object would be not the floor but the character…

Here’s what the problem looks like, left being the server and right being the client, you can see that the client is aiming at the ground but still the line trace is horizontal

Below are the setups in my blueprint

If I change the event ‘setAtkButtonDown’ from run on server to run on owning client, the trace works for client but of course it cannot apply damage…

btw I found a thread with the similar issue but still can;t figure it out

thanks for the quick reply, the whole blueprint of my character has a CapsuleComponent and this capsule has children components which are the skeletal mesh and the camera. What do you mean by getting the camera from the character?

OMG what a fool I was, I got it solved…The problem is, I can’t get that forward vector from the camera, instead I need to get it from the player controller…That also explains why the line trace was always horizotal: beacuse the camera was put horizontally in the blueprint…