public HitOperation(BaseViewport view, Point mousePosition) { viewport = view; ray = view.ViewportToRay(mousePosition.X, mousePosition.Y); hasIntersected = false; t = float.MaxValue; HitMapObject = null; }
/// <summary> /// Check if selected solid aabb is hit /// </summary> private bool IsSelectedSolidAabbHit(int x, int y, BaseViewport viewport) { if (controller.Selection.Empty) { return(false); } Ray ray = viewport.ViewportToRay(x, y); return(ray.IsIntersecting(controller.Selection.Bounds)); }
/// <summary> /// Check if we hit the handles /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="viewport"></param> /// <returns></returns> private int GetGrableHandleHit(int x, int y, BaseViewport viewport) { MapObjectGroup selectedMapObjectGroup = controller.Selection; if (selectedMapObjectGroup.Empty) { return((int)SolidGrabHandles.HitStatus.None); } Matrix4 toGridMatrix = viewport.Camera.GetWorldMatrix().ClearTranslation(); SolidGrabHandles handles = controller.RubberBand.Handles; handles.CreateHandles(selectedMapObjectGroup, toGridMatrix, viewport.Zoom); return(handles.CheckHit(viewport.ViewportToRay(x, y))); }
public SolidFaceHitOperation(BaseViewport view, Point mousePosition) { ray = view.ViewportToRay(mousePosition.X, mousePosition.Y); t = float.MaxValue; }