Unity-Technologies / arfoundation-samples

Example content for Unity projects based on AR Foundation
Other
3.03k stars 1.13k forks source link

ARTranslationInteractable acts like Wile E. Coyote [Bug] #666

Closed sam598 closed 3 years ago

sam598 commented 3 years ago

When dragging objects in the Interaction.unity example scene, the object will always be placed at the height of the highest detected plane below the camera, even if a lower plane is being selected and is not occluded.

For example; if a plane is detected on the floor and another is on a table, objects will always be placed at the height of the table unless the phone is lower than the table.

This is happening because the function GestureTransformationUtility.GetBestPlacementPosition Raycasts against TrackableType.Planes instead of TrackableType.PlaneWithinBounds or even better TrackableType.PlaneWithinPolygon.

This means it treats all planes as infinite, and since GetBestPlacementPosition only checks against the first detected plane it creates a frustrating user experience. A temporary workaround is to modify ARTranslationInteractable.cs and GestureTransformationUtility.cs, but there probably needs to be a more robust solution to support multiple platforms.

This was tested with iOS 14 and AR Foundation 4.1.0-preview.13.

chucknology commented 3 years ago

MEEP MEEP!!

tdmowrer commented 3 years ago

+1 for issue title

mattdatwork commented 3 years ago

We're looking into it. We'll post more info once we've confirmed whats going on.

tropicdragon commented 3 years ago

Hello! What iOS device are you using when you get this issue?

sam598 commented 3 years ago

Hi @tropicdragon

I have tested and experienced this issue in iOS 14 on an iPhone X, iPhone 12 Pro Max, and iPad Pro (4th gen).

I don't think the issue is phone specific, but rather a logical error with how the scripts handle raycasts. It is raycasting TrackableType.Planes which returns all planes including TrackableType.PlaneWithinInfinity. If all planes are infinite then the first received raycast is always the one closest to the camera.

There are a few other logical issues/difficulties with ARTranslationInteractable:

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

sam598 commented 3 years ago

Tested with ARFoundation 4.1.1 on an iPhone 12 Pro Max where the issues are still present. On a Galaxy S8 objects can be placed at different heights, although it will sometimes it will rise to the height of a higher plane unexpectedly.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

sam598 commented 3 years ago

Bumping for stale bot.

tropicdragon commented 3 years ago

Hello, just wanted to inform that there is a solution for the issue where translating an object causes it to go to the level of the highest plane. This fix should be available in 1.0.0-pre.2 of the xr interaction toolkit package, which will be released soon.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.