Line Trace doesn't rotate properly with player controller

Hello, I am relatively new to UE and struggling a lot with rotation and how it relates to capsule direction.

I’ve created a Line Trace melee weapon which is intended to just trace in between two sockets on the weapon mesh. This is working just fine:

However, I’ve also created a lock-on mechanic that forces the Actor Rotation towards a ‘locked’ target. For whatever reason, even though my player Actor is faced in the intended direction, and the weapon mesh (and sockets) are looking in the intended direction, the line trace still rotates freely with the mouse or gamepad stick.

Here’s what it looks like when I’m ‘locked on’ and activating the line trace, but also rotating the mouse or gamepad stick:

Question:
How do I force a trace to look in the same direction as the actor? How is it possible that my sockets are rotating even though the weapon mesh is perfectly still?

Thank you

Hey @Startronz!

So the line trace in this instance is going to have nothing to do with where the character is facing, only the two sockets. I think the answer may lie in your lock-on code, for instance, if you’re using tick to maintain a lookat rotation, you can still give input and in between frames it WILL be rotated in that other direction until the tick hits, the mesh is rotated back, and visual frame is rendered! Let’s see some of that lock on code! :slight_smile:

Thank you @Mind-Brain,

I’m using a separate ‘scanning’ line trace to seek actors, then when it hits one it runs this code to ‘lock-on’ to the hit actor:

I know ‘set actor rotation’ is probably the wrong node for this, but I’m not exactly sure what the right one is.
Set Actor Rotation rotates my entire player instead of just the upper body which is a separate problem (still learning animBP’s) but now I’m wondering if the two issues are connected.

Thank you

Yes, individualizing parts of the body is done through the anim_BP. Here you are setting the entire actor’s rotation, so you’re going to get a reaction from the entire actor. :slight_smile:

I wasn’t aware you were trying to mainly rotate the top half- but one step at a time! Are the traces set to disappear after a few seconds or to persist indefinitely? If it’s set to indefinite you could be getting some false positives. Also, how are you rotating? Mouse turn? If you’re using mouse to rotate the player, you could have some inputs getting through before the tick.

Is there any way you could show what’s happening in a video?