RayIntersectsPlane returns wrong results

The RayIntersectsPlane node returns wrong results as the intersection in Stride.Core.Mathematics.CollisionHelper.cs appears to be faulty.

The culprit seems to be the negation of D here that is not necessary.

I created a patch, demonstrating the problem. In this i also repatched the Intersection method to return the correct results. (Maybe also interesting: it shows how to get the Transformation of a plane from a point and a normal. Would probably be a nice convencience node to have for the lib…)

grafik

What I’m not sure of is where this bug should be fixed - probably in the original Stride sources. However I wonder where this negation of D actually comes from, there should be a reason why it was there originally (and what I can tell from the sources is that this CollisionHelper goes back to SlimDX).

RayIntersectsPlaneFixed_v2.vl (69.4 KB)

2 Likes

If it doesn’t make it into the standardlibs, consider adding it to the addons :)

related issue (thx @tonfilm and @joreg):