Ray intersection with 3D quads in XNA?

后端 未结 3 1334
野趣味
野趣味 2021-01-20 09:19

So I have successfully made a ray the represents the mouse unprojected into the world, and now I need to check if that ray can intersect with a quad object, here is the code

3条回答
  •  轮回少年
    2021-01-20 10:09

    I'm not sure exactly what they mean by "distance along the normal from the origin", but I would assume it just mean the distance from the origin. You can get that from the length property on a Vector3.

    If that doesn't work, there is also a constructor for plane which takes three points on the plane:

    public Plane (
         Vector3 point1,
         Vector3 point2,
         Vector3 point3
    )
    

    You can use this with any 3 points on the plane, such as the corners of your quad, to create a plane.

提交回复
热议问题