Fix editor raycast

This commit is contained in:
ExMatics HydrogenC
2024-06-04 08:39:14 +08:00
parent a8dc67a1b2
commit cde3e3d710
3 changed files with 9 additions and 11 deletions
+3 -3
View File
@@ -1398,9 +1398,9 @@ namespace FlaxEditor.Viewport
Matrix.Multiply(ref v, ref p, out var ivp);
ivp.Invert();
// Create near and far points
var nearPoint = new Vector3(mousePosition, _nearPlane);
var farPoint = new Vector3(mousePosition, _farPlane);
// Create near and far points, with device depth of 1 and 0 respectively
var nearPoint = new Vector3(mousePosition, 1.0f);
var farPoint = new Vector3(mousePosition, 0.0f);
viewport.Unproject(ref nearPoint, ref ivp, out nearPoint);
viewport.Unproject(ref farPoint, ref ivp, out farPoint);