Search Unity

Foundation AR, ARSessionOrigin doesn't reconize the Raycast method?

Discussion in 'AR' started by miranoren, May 17, 2019.

  1. miranoren

    miranoren

    Joined:
    Dec 4, 2016
    Posts:
    1
    Hi,

    So I just started production with AR Foundation, but I get that the class Foundation AR, ARSessionOrigin class doesn't recognise the Raycast method. According to their documentation it should do. Does anyone have any ideas.
    Ive tried the script on 2018.3.8 and 2019.1.3f1. I get other method to work such as MakeContentAppearAt. But the rays cast method is nowhere to be found (for me). please help!
     
  2. yolon3000

    yolon3000

    Joined:
    Aug 1, 2018
    Posts:
    5
    same question,can any one explain it ?
     
  3. n1ghtbird

    n1ghtbird

    Joined:
    Nov 6, 2018
    Posts:
    6
    Same issues on Unity 2019.1.0f2 with ARFoundation 2.1.

    I get the following errors appearing:
    'ARSubsystemManager' is missing in the current context
    'ARPlaneManager' does not contain definition for 'GetAllPlanes'
    'AROrigin' does not contain definition for 'Raycast'

    Have tried resetting the packages but to no avail.
     
  4. n1ghtbird

    n1ghtbird

    Joined:
    Nov 6, 2018
    Posts:
    6
    albertoha94 likes this.
  5. KelsoSharp

    KelsoSharp

    Joined:
    Feb 24, 2018
    Posts:
    3
    You need to create a raycast manager and use it instead of the ARSessionOrigin like this

    var hitsList = new List<ARRaycastHit>();
    var rayCastMgr = GetComponent<ARRaycastManager>();
    rayCastMgr.Raycast(screenCenter, hitsList, TrackableType.Planes);
     
    albertoha94 likes this.
  6. ricardovalquin

    ricardovalquin

    Joined:
    Feb 19, 2019
    Posts:
    3
    Hi guys, thank you so much for the explanation, but a question for @KelsoSharp , calling the raycast manager and sending the TrackableType.Planes gives me an error:
    The name 'TrackableType' does not exist in the current context
    Is something that I need to import/define in the global scope?
    thank you so much
     
  7. maor_unity

    maor_unity

    Joined:
    Jun 11, 2018
    Posts:
    1
    did you manage to get it to work? im having the exact same problem
     
  8. markl_laha

    markl_laha

    Joined:
    Jun 29, 2018
    Posts:
    1
    added UnityEngine.XR.ARSubsystems; at the top since TrackableType seems to be associated to it, which is misleading since the migration guide explicitly said that the ARSubsystems manager has been removed. So I don't know if that's helped or if that's even the correct course of action, but it at least allows you to use TrackableType.
     
  9. ricardovalquin

    ricardovalquin

    Joined:
    Feb 19, 2019
    Posts:
    3
    Hi @markl_laha I already have that imported, now I'm getting this:

    NullReferenceException: Object reference not set to an instance of an object
    ArTabToPlace.UpdatePlacementPose () (at Assets/scripts/ArTabToPlace.cs:57)

    upload_2019-7-18_11-28-30.png

    and those are my imports:
    upload_2019-7-18_11-29-24.png
     
  10. ricardovalquin

    ricardovalquin

    Joined:
    Feb 19, 2019
    Posts:
    3

    Solved, added an Input manager to the ARSessionOrigin in the scene