Closed artyomabgaryan closed 1 year ago
I believe this is the expected behavior on Android.
In AR Foundation, the normal points along +Y while the X and Z axes are parallel to the surface. However, there are many choices for X and Z and it is up to the underlying AR backend to determine what they are. All choices are equally valid.
From the ARCore docs:
ArPlane : X+ is perpendicular to the cast ray and parallel to the plane, Y+ points along the plane normal (up, for AR_PLANE_HORIZONTAL_UPWARD_FACING planes), and Z+ is parallel to the plane, pointing roughly toward the user's device.
Therefore, the pose of the hit point rotates as you move because they have chosen Z+ such that it always points toward your device.
If having a "steady" rotation is important to you, you can construct one by using the hit normal and world up, e.g., using Quaternion.LookRotation:
// Note: only works for vertical surfaces since
// horizontal surface normals are colinear with world up.
var rotation = Quaternion.LookRotation(forward: hit.pose.up);
Well thank you so much, Tim. This helped me to solve my problem, but as I said the behavior is very strange. Thanks again.
Describe the bug Casting rays against vertical plane returns steady point in space in UNITY Editor, but on device it returns very strange result which you can see on video below Editor: https://www.dropbox.com/s/4nrgqpg1gclx847/Unity_U8mEKylotL.mp4?dl=0 Device: https://www.dropbox.com/s/5wqeq5fwbzo6yvh/Screenrecorder-2022-12-24-21-12-55-294%280%29.mp4?dl=0
To Reproduce Steps to reproduce the behavior:
Expected behavior In Editor you'll getting "steady" rotation of hit point after raycast Raycast returns result in editor (editor link above)
Actual behavior On device I'm getting strange rotation of hit point after raycast Raycast returns result like in video above (device link above)
Smartphone (please complete the following information):