/// <summary> /// GetIntersectedEntity /// </summary> /// <returns></returns> private MyEntity GetIntersectedEntity() { MyLine mouseSelectionLine = MyUtils.ConvertMouseToLine(); var result = MyEntities.GetIntersectionWithLine(ref mouseSelectionLine, null, null); MyEntity entity = result.HasValue ? result.Value.Entity : null; if (entity is MyLargeShipGunBase) { entity = ((MyLargeShipGunBase)entity).PrefabParent; } if (m_bEnableAABBUnderMouse) { m_physOverlapElemList.Clear(); MyEntities.GetIntersectedElements(ref mouseSelectionLine, m_physOverlapElemList); } return(entity); }