Incorrect AimDownSight Linetraces when moving and autofiring

How to perform correct line traces for Aiming Down Sights when moving and on automatic fire?

For some reason the linetraces are incorrect while moving AND on autofire. They work correctly if im not on autofire. Does anyone has a clue what is going on?

While standing still:
BuggyLineTraceStanding

While moving and on autofire:
BuggyLineTraceMoving

The Blueprint:

Please show the source of the start of the linetrace while moving. It seems like it might be adding a vector to it improperly.

I forgot to add the blueprint image. I updated the post.

Not really sure why you are converting to screen and then to world. Why not just get the aim socket location in world space and feed that into the start location. You could also use that location adding a forward vector of the gun multiplied by range (a float) to get the and of the trace.

I try to find a way where the EndVector is perfectly alligned with the IronSight.

If I use the forward vector of the gun, the EndVector of the line trace will go out of sync the further I shoot.

This happens because the LineTrace is rotated in a cone. This is perfectly fine for hipfire.
But maybe I’m missing something.

Your answer gave me the idea to calculate the correct vectors without projecting between world and screen locations. I’ll try to find a calculation based on ADSSocketLocation, CameraLocation, CameraForwardVector and Range.

I tried the ‘ForwardVectorGun’ solution.

It kinda works but has a down sight.

If firing with high recoil, the Endvector will be way of screen.
BuggyLineTraceGunForward

Use (GetAimSocketLocation - CameraLocation) as direction vector.

Trace Start : GetAimSocketLocation
Trance End : GetAimSocketLocation + (GetAimSocketLocation - CameraLocation).Normalize * Range

1 Like

Thank you for the solution I was looking for. Couldn’t get my head arround.

For the ‘LinetraceStartVector’ I went for the ‘CameraLocation’ instead so that whenever the player shoots, it ensures that we hit anything that is visible on the screen.


‘GetLineTraceStartVector’ == CameraLocation

Here’s the final result.

BuggyLineTraceGunSolution

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