Hi,
I’m trying to do some raycasting in a networked project. However I have an inaccuracy issue that I can’t manage to solve.
So here are my steps:
- Get the mouse screen position
- Convert them to world coordinates using DeprojectScreenToWorld
- Calculate the direction vector from the player camera, to the projected 3D mouse point we got in step 2
- Execute LineTraceByChannel and spawn a cone at the hit location point
However, it’s not accurate compared to the GetHitResultUnderCursorByChannel build-in function. I use it like this and it works perfectly.
Please take a look at the results screenshot. In RED the results of my custom raycasting. In BLUE the result of the build-in raycasting.
What is wrong here ?
Thanks for reading, best regards.