/// <summary> /// Raycasts along the given ray and returns the intersection with the flat canvas. /// Use to convert from world space to flat canvas space. /// </summary> /// <param name="ray"></param> /// <returns> /// Returns the true if ray hits the CurvedCanvas. /// Outputs intersection point in flat canvas space. /// </returns> public bool RaycastToCanvasSpace(Ray ray, out Vector2 o_positionOnCanvas) { CurvedUIRaycaster caster = this.GetComponent <CurvedUIRaycaster>(); o_positionOnCanvas = Vector2.zero; switch (Shape) { case CurvedUISettings.CurvedUIShape.CYLINDER: { return(caster.RaycastToCyllinderCanvas(ray, out o_positionOnCanvas, true)); } case CurvedUISettings.CurvedUIShape.CYLINDER_VERTICAL: { return(caster.RaycastToCyllinderVerticalCanvas(ray, out o_positionOnCanvas, true)); } case CurvedUISettings.CurvedUIShape.RING: { return(caster.RaycastToRingCanvas(ray, out o_positionOnCanvas, true)); } case CurvedUISettings.CurvedUIShape.SPHERE: { return(caster.RaycastToSphereCanvas(ray, out o_positionOnCanvas, true)); } default: { return(false); } } }
public bool RaycastToCanvasSpace(Ray ray, out Vector2 o_positionOnCanvas) { CurvedUIRaycaster component = base.GetComponent <CurvedUIRaycaster>(); o_positionOnCanvas = Vector2.zero; switch (this.Shape) { case CurvedUIShape.CYLINDER: return(component.RaycastToCyllinderCanvas(ray, out o_positionOnCanvas, true)); case CurvedUIShape.RING: return(component.RaycastToRingCanvas(ray, out o_positionOnCanvas, true)); case CurvedUIShape.SPHERE: return(component.RaycastToSphereCanvas(ray, out o_positionOnCanvas, true)); case CurvedUIShape.CYLINDER_VERTICAL: return(component.RaycastToCyllinderVerticalCanvas(ray, out o_positionOnCanvas, true)); } return(false); }