Unity-Technologies / arfoundation-samples

Example content for Unity projects based on AR Foundation
Other
2.99k stars 1.11k forks source link

Position not going to reset once switch scene #1008

Closed Unity3D-Hardik closed 1 year ago

Unity3D-Hardik commented 1 year ago

How do I... Hello, Any one know how we can reset AR Session after switching scene. ?

Issue : Camera position not going to Vector.zero

How to reproduce :

Any one know how can i reset AR Scene camera Position ?

I am using Unity 2021.3.10 and Latest AR Foundation GitHub repository sample

Unity3D-Hardik commented 1 year ago

Destroy AR Session Game object tested with no luck.

ankur-unity commented 1 year ago

To reset the session, you can use the ARSession.Reset() API which will also reset the camera position to zero. Note that resetting the ARSession will also destroy all the trackables. https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@5.0/api/UnityEngine.XR.ARFoundation.ARSession.html#UnityEngine_XR_ARFoundation_ARSession_Reset

I also tested the samples from main for AR Foundation 5.0.2 on 2021.3.10f1 and couldn't reproduce the issue. The camera reset back to zero when switching scene and when pressing "Reset" button from the SimpleAR scene.

How are you checking the camera position?

nextechar-hardik commented 1 year ago

I have test that. this only work if we pass reference in button and then call reset method. but if we try to get AR Session runtime in script and Call that method its not working.

andyb-unity commented 1 year ago

Please file a bug and post your case number here so our QA team can take a look: https://unity3d.com/unity/qa/bug-reporting

nextechar-hardik commented 1 year ago

I am using AR Foundation 4.2.6 , and can reproduce with sample code as well. Unity version 2021.3.10

nextechar-hardik commented 1 year ago

Not able to reproduce in AR foundation 5.0.2.

ankur-unity commented 1 year ago

Closing as resolved since the issue is not reproducible. If it start to occur again then feel free to file a bug with Unity: https://unity3d.com/unity/qa/bug-reporting