Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

iOS bug in ARRaycastManager.Raycast(Vector2 ..)?

Discussion in 'AR' started by Mattias_Ohman, Oct 24, 2019.

  1. Mattias_Ohman

    Mattias_Ohman

    Joined:
    Jul 4, 2019
    Posts:
    1
    The code below works fine on Android but on iOS the raycastManager does not find any hits of type TrackableType.Image.

    I have tested it with the latest ARFoundation Version 3.0.0 preview 4.


    Code (CSharp):
    1.      private void FindTrackedImage()
    2.         {
    3.             ARRaycastManager raycastManager = GetComponent<ARRaycastManager>();
    4.             List<ARRaycastHit> raycastHits = new List<ARRaycastHit>();
    5.             Vector2 screenCenter = new Vector2(Screen.width / 2, Screen.height / 2);
    6.  
    7.             if (raycastManager.Raycast(screenCenter, raycastHits, TrackableType.Image))
    8.             {
    9.                 TrackableId targetedImageId = raycastHits[0].trackableId;
    10.                 ARTrackedImage targetedImage = trackedImageManager.trackables[targetedImageId];
    11.                 // do really interesting stuff with the targedImage here:          
    12.  
    13.      }
    14.         }
     
    Last edited: Oct 24, 2019