New answers tagged

0

I fixed the problem. When the ray was facing up or right I was substracting 1 from the rounded position of the ray to get the first intersection. Substracting a smaller number like 0.001 fixed it.


0

Subtract to get the position difference: /** * Show ray between two points */ void ShowRayBetweenPoints (Vector3 p1, Vector3 p2) { Debug.DrawRay (p1, (p2 - p1), Color.yellow); }


0

I assume you're using 8.0 for scaling here? _y *= 8.0; _x *= 8.0; The scaling needs to take account the current horizontal FOV and viewport/screen width. I've found that if your FOV is 90 degrees using (ViewWidth/2) as the scaling factor works well. If it's not 90 degrees FOV, you can approximate it via 90.0/fov * (ViewWidth/2)


Top 50 recent answers are included