im trying to do a linetrace from the the gun muzzle socket to where the camera is facing but when i do i get a weird offset any ideas on how to remove it
the debug sphere is where the trace actually hit but i want it to be where the crosshair is
im trying to do a linetrace from the the gun muzzle socket to where the camera is facing but when i do i get a weird offset any ideas on how to remove it
the debug sphere is where the trace actually hit but i want it to be where the crosshair is
If I’m understanding this correctly, the offset is caused due to the difference in distance between the Trace End and the object it Hit.
blue = trace
red = camera forward vector
Reducing 9999 to something lower should reduce the offset.
A solution would be to use two Line Traces. The first one directly from camera in forward direction. See if it hit’s anything, if it does, do another trace from the gun like above, but use the previous trace’s hit location as the end. Although I’m not sure how viable this would be for really close traces.
i tried the 2 line approach at both long distance and short distance and it works great thank you : )
You trace out from the camera a set distance. Use the Hit results “Impact Location and trace end” on a Select vector.
Get the Muzzle location via Get Socket Location. Use “Find Look at Rotation” to give you a transform.
e.g. Find look at Rotation (Muzzle Location, Select Vector)
This will put your shots dead on the crosshairs if they are center screen.
You don’t need the zeroing aspect.
Essentially we are doing this…
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.