Find where a ray intersects the origin?

So, I've a need to get the point on a Ray where z=0, how do I do that?



Basically, I need to know where the mouse cursor is in relative world coordinates, since apparently DisplaySystem.getDisplaySystem().getWorldCoordinates() can't take an absolute z value.

NM, fixed it. I needed to use:

Vector2f screenPosition = new Vector2f(MouseInput.get().getXAbsolute(), MouseInput.get().getYAbsolute());

      

      

      Vector3f worldCoords = DisplaySystem.getDisplaySystem().getWorldCoordinates(screenPosition, 0);

      Vector3f worldCoords2 = DisplaySystem.getDisplaySystem().getWorldCoordinates(screenPosition, 1);

      

      

      Ray mouseRay = new Ray(worldCoords, worldCoords2.subtractLocal(worldCoords).normalizeLocal());

      Vector3f intersection = new Vector3f();

      mouseRay.intersectsWherePlane(new Plane(new Vector3f(0,0,1),0f), intersection);

Thanks for posting a solution to your own problem - there are so many that forget if they work it out.

Questions with answers like this are a blessing to maths idiots like myself  :smiley: