Negar Bean
Negar Bean

Reputation: 65

Interact with several ModelEntities

Is there an easy way to interact with several ModelEntities in RealityKit at the same time? for example rotate two ModelEntities with one multi-touch gesture.

Upvotes: 2

Views: 419

Answers (1)

Andy Jazz
Andy Jazz

Reputation: 58063

Of course you can. Just create a parent entity for two or more children.

let parentEntity = Entity()
parentEntity.addChild(childEntity01)
parentEntity.addChild(childEntity02)
    
arView.installGestures([.all], for: parentEntity as! Entity & HasCollision)

P. S.

Also, this post will show you how raycasting works in conjunction with RealityKit gestures.

Upvotes: 3

Related Questions