Summary: Remove touch gestures on an AR object after adding it?
AR View Code (Just the relevant bit). Where arObject is a model entity with a mesh, material and a collision shape.
func updateUIView(_ uiView: ARView, context: Context) {
arObject = CreateCustomModelEntity()
uiView.installGestures([.translation, .rotation], for: arObject)
}
The above could would add touch gestures to my arObject and allow it to be rotated and moved across the anchored plane.
However, I want to remove the touch gestures after adding it.
User Flow:
The user would click a model, move it around and place it where they'll like and touch the Confirm button. After the confirm button is touched, the arObject can no longer be moved around.
Looking at the Apple docs, there's an installGestures, but no equivalent removeGestures. Is this even possible?
A few ideas,
- completely remove the anchor and recreate it (but then the placement of the object is lost, so this is bad)
- Override the existing child ar object with a new one without the touch gestures installed. I believe this would retain the object placement, but double creating ar objects isn't ideal unless there's no other solution.
- Create a temp ar object with install gestures and then override it with a new arObject (without touch gestures) after placement has been confirmed. Similar to 2. solution.