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?
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.
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.