Drag Gestures

Dear all,

I am experiencing some problems with the Drag Gesture in VisionOS. Typically, this gesture involves the user pinching an entity or, more commonly, a window, and moving/dragging it around. However, this is not always the case for entities (3D models) placed in the environment. It appears that the user can both pinch and drag and/or move the entity with their bare hands.

In the latter case, the onChange cycle doesn't always end if the user keeps their hands near the object, causing it to keep moving even if that is not what the user intends. This also occurs when the user is no longer hovering over that entity. Larger entities, more so than those in the demo "TransformingRealityKitEntitiesUsingGestures," close to the user seem to become attached to their hands, causing the gesture to continue indefinitely. Entities often move to unintended positions.

I believe that these two different behaviors within the same gesture container are intrinsically different: one involves pinching and dragging, while the other involves enabling hands physics, and it should be easy to distinguish between the two.

How can we correctly address this situation?

Thank you for your assistance

Can you confirm the Entity's collision shapes, which may be different from the mesh, are correct? Do the following to visualize your collision shapes.

  • In debug mode open "Debug Visualizations" by clicking the button to the right of the "step out" button in the "Debug Area" (bottom pane). It kind of looks like a box.
  • Select "Collision Shapes and Axes".
  • Doing this will outline the collision shapes around the entities in your application.

Verify your collision shapes are correct. If they are not use ShapeResource to generate the correct shapes. There are methods for a primitive (box, sphere, capsule) mesh, convex mesh and static mesh.

Yes, I can confirm that the bounding boxes are correctly set and match the mesh. Is there a recommended approach to distinguish drag gestures made by the user using their hands, by pushing/pulling on the mesh, from those made using the pinch/drag gesture? This would help me generate additional logic, smoothing the animation accordingly or even ignoring some data—partially or entirely—if necessary, to improve the overall experience.

Additionally, regarding collisions, hands won't go through these entities as they are being pushed away. However, these entities go through each other, even though ideally they shouldn't. What would be the best approach to address this issue?

Thank you!

I meant to say "collision shapes," sorry.

Drag Gestures
 
 
Q