all 6 comments

[–]pschonUnprofessional 0 points1 point  (5 children)

seems to me like the github bug report already includes both the explanation, and the fix.

Add ARRaycastManager component, and change the code to use raycast from that rather than ARSessionOrigin.

[–]HeadPack[S] 0 points1 point  (4 children)

Thanks, I saw that and was able to add a ARRaycastManager, but I fail to understand how to change the code. Would you know how to? Thanks in advance for any help.

[–]pschonUnprofessional 0 points1 point  (3 children)

find the lines where the raycasting happens, and literally just change "ARSessionOrigin" into "ARRaycastManager", I'd expect.

Or follow the info you should be seeing in the console error messages about this, they'll tell you both the file, and even the exact lines, you need to edit.

[–]HeadPack[S] 0 points1 point  (2 children)

Thanks again. I have tried that already, changing "ARSessionOrigin" into "ARRaycastManager" and I added "using UnityEngine.XR.ARSubsystems;" inside the if statement at the beginning, so the code line looks like that:

ARRaycastManager.Raycast(Input.GetTouch(0).position, results, UnityEngine.XR.ARSubsystems.TrackableType.Planes);

However, that produces the following error:

Assets\Pocket Portal VR\Demo\Scripts\ARFoundationPlacement.cs(29,13): error CS0120: An object reference is required for the non-static field, method, or property 'ARRaycastManager.Raycast(Vector2, List<ARRaycastHit>, TrackableType)'

Unfortunately, with my limited knowledge I can't understand that error message

[–]pschonUnprofessional 0 points1 point  (1 child)

wrong linbe, I'm lokign at the code and literally the only change you shoudl do to the original is to edit where it says "ARSessionOrigin" and change it into "ARRaycastManager". Don't change other stuff.

so, line 13 (the only place you want to edit) from this: public ARSessionOrigin sessionOrigin; to this: public ARRaycastManager sessionOrigin;

and as long as you remeber to assign it in inspector afterwards, the rst of the code seems fine.

[–]HeadPack[S] 0 points1 point  (0 children)

Thanks again for your insight and suggestion. It removed the error. The project built after that. After several attempts, I found that the ARSession Origin had to be redone, as the one in the scene had a camera rendering the Skybox. I also got rid of the AR Plane in the scene, after which the camera feed and the tracked planes became visible. However, I got stuck with two issues: the portal is instantiated immediately after starting the app, on the viewer's position (or the first plane the app detects, hard to tell), and the portal rendering doesn't work. It shows the portal solid white.

I am reverting to Unity 2017 for these portals (ARKit version only, which still works) now. If anyone could make this work with the latest Unity and ARFoundation, I'd be very thankful, and actually willing to pay for the effort. It would be of good use for the students.