Hi, all,
I'm exploring some visionOS project. And let's say I'd like to detect a vertical plane and paste a poster using sample code below:
let wallAnchor = AnchorEntity(.plane(.vertical, classification: .wall, minimumBounds: SIMD2<Float>(0.6, 0.6)))
My understanding is that the plane/wall detection will always start from the center of the user's view. So I want to keep updating the wallAnchor until user is satisfied with where the poster locates. And I'm doing simply something like below:
wallAnchor.reanchor(.plane(.vertical, classification: .wall, minimumBounds: SIMD2<Float>(0.6, 0.6)))
Ideally I want to keep doing above in every frame so the poster can update continuously. But to begin with, I'm just doing it every 1 second.
However, the issue is that reanchor doesn't seem to work properly. For one, it only successfully detects a plane/wall like every 3 seconds (even without moving the camera view), so the poster only shows up 1/3 of the time; second, after some slight move then keep steady, the poster starts to keep shifting and shrinking even without moving the camera view.
It seems like the wallAnchor only works as expected for the first time when initialized, but not with the reanchor function
Could you please let me know what am I doing wrong here? And what is the proper way to update the anchorEntity in a smooth way? Thanks a lot!