Question by
belhadj_hmida · Jul 31, 2017 at 05:03 AM ·
raycast
Physics.Raycast Hit Distance
Hi, I am just getting started with Unity Engine and i am having a little problem with the HitResult.distance value outputed from physics.raycast. Here is a video i recorded about how the problem looks like:
As you can see in the video, i am controlling a camera with a raycast from the cube to the camera and i am using 3 raycast only for better result (c# code in last 15 seconds).
The distance given by the raycast function in output is varying with a noticed value like in a frame it is 1.9 and in the next 2.3 and in the next it is 1.9.
i tried using an average between the previous given distance and the current distance to reduce the difference but it didn't work .
Thanks.
Comment