To interact with an entity you need to
generate collision shapes:
let model = try await ModelEntity(named: modelName)
model.generateCollisionShapes(recursive: true)
model.components.set([InputTargetComponent()])
add a rotate gesture to your reality view
.gesture(RotateGesture().targetedToAnyEntity().onChanged({ value in
//access the entity targeted with value.entity and the angle with value.rotation.radians
}))
On a simulator press the option key and rotate.
Topic:
App & System Services
SubTopic:
Core OS
Tags: