Hello.

I've posted this question on two different forums already. But it seems, people don't the answer or, which is more than likely, don't want to answer on that question. So, I just copy this question here and might be someone will help me with this problem.

OK, here is my code for transforming 2D mouse coordinates into 3D world coordinates, which for some strange reasons shows to me a wrong results:

```
MouseState state = Mouse.GetState();
Vector3 nearSource = new Vector3((Single)state.X, (Single)state.Y, 0);
Vector3 farSource = new Vector3((Single)state.X, (Single)state.Y, 1);
Vector3 nearDest = this.graphics.GraphicsDevice.Viewport.Unproject(nearSource, this.projection, this.view, this.world);
Vector3 farDest = this.graphics.GraphicsDevice.Viewport.Unproject(farSource, this.projection, this.view, this.world);
Vector3 direction = farDest - nearDest;
direction.Normalize();
Ray ray = new Ray(nearDest, direction);
Vector3 norm = new Vector3(1.0f, 0f, 1.0f);
Plane plane = new Plane(norm, 0.0f);
//Since the ray equation is P = P0 + t*P1 and the plane equation is n.P = -d
Single t = -(plane.D + Vector3.Dot(ray.Position, plane.Normal)) / (Vector3.Dot(ray.Direction, plane.Normal));
this.resultVector = nearDest + direction * t;
```

And there is another one for the ray. In this code I attempted to get intersection points on a bounding box. But After the ray transformation with invert matrix I got a situation in that my ray will intersect all 6 faces of the bounding box:

`Ray ray = new Ray(Vector3.Transform(nearDest, Matrix.Invert(this.cubeModel.Meshes[0].ParentBone.Transform)), Vector3.Transform(direction, Matrix.Invert(this.cubeModel.Meshes[0].ParentBone.Transform)));`

In the code above I took the object transformation matrix and inverted it hoping to get some result. And the result was as shown below:

{X:-1.527575E-07 Y:-0.1127879 Z:-3.105072}

{X:-1.527575E-07 Y:-0.1127879 Z:-3.105072}

{X:10.00013 Y:-1.509978E-06 Z:10.00018}

{X:10.00013 Y:-1.509978E-06 Z:10.00018}

{X:2.369367 Y:-0.08606504 Z:-1.035683E-07}

{X:2.369367 Y:-0.08606504 Z:-1.035683E-07}

Do you have any ideas, how could I get ray-bounding box intersection points?

Thank you in advance.