What’s the easiest way to add user interactions (pinch to scale, rotation, transform) to an Entity loaded from a local USDZ file in RealityKit?
You can use the installGestures function on ARView
. Keep in mind that the entity will need to conform to HasCollision
.
To do this you could create your own CollisionComponent
with a custom mesh and add it to your entity or you could simply call generateCollisionShapes(recursive: Bool) on your entity. Putting it all together, you can use .loadModel
/.loadModelAsync
, which will flatten the USDZ into a single entity. Then call generateCollisionShapes
and pass that entity to the installGestures
function. This will make your USDZ one single entity that you can interact with.