//mxd. public Vector2D GetHitPosition() { Vector3D start = General.Map.VisualCamera.Position; Vector3D delta = General.Map.VisualCamera.Target - General.Map.VisualCamera.Position; delta = delta.GetFixedLength(General.Settings.ViewDistance * 0.98f); VisualPickResult target = PickObject(start, start + delta); if (target.picked == null) { return(new Vector2D(float.NaN, float.NaN)); } // Now find where exactly did we hit VisualGeometry vg = target.picked as VisualGeometry; if (vg != null) { return(GetIntersection(start, start + delta, vg.BoundingBox[0], new Vector3D(vg.Vertices[0].nx, vg.Vertices[0].ny, vg.Vertices[0].nz))); } VisualThing vt = target.picked as VisualThing; if (vt != null) { return(GetIntersection(start, start + delta, vt.CenterV3D, D3DDevice.V3D(vt.Center - vt.PositionV3))); } return(new Vector2D(float.NaN, float.NaN)); }