Exemple #1
0
            public static Vector3 ScreenToV3(GeneralCameraComponent camera, Vector2 screen, float winW, float winH, float delta)
            {
                var c = new Viewport().UnProject(camera.GetState(), winW, winH, screen);

                var plane = new SharpDX.Plane(camera.Position.ToSDXVector3(), camera.LookDirection.ToSDXVector3());
                var ray   = new SharpDX.Ray(c.Origin.ToSDXVector3(), -c.Direction.ToSDXVector3());
                var inter = plane.Intersects(ref ray, out SharpDX.Vector3 point);

                return(new Vector3(point.X, point.Y, point.Z));
            }
Exemple #2
0
        public Vector3 ScreenToV3(Vector2 screen, CameraState camera, IAppWindow window)
        {
            var winW = window.Width;
            var winH = window.Height;

            var c = UnProject(screen, camera, window);

            var plane = new SharpDX.Plane(camera.Position.ToSDXVector3(), camera.LookDirection.ToSDXVector3());
            var ray   = new SharpDX.Ray(c.Origin.ToSDXVector3(), -c.Direction.ToSDXVector3());
            var inter = plane.Intersects(ref ray, out SharpDX.Vector3 point);

            return(new Vector3(point.X, point.Y, point.Z));
        }
 public void ScreenClicked(SharpDX.Ray r)
 {
     listBoxObjects.SelectedIndex = layoutSystem.ScreenClicked(r);
 }