How to installGestures on Reality Composer
Reality Composer 1.5 allows you implement gestures only for running animated behaviours. At the moment there's no way to turn on Tap
, Rotation
or Pinch
gestures in Reality Composer. Only via RealityKit, as you indicated.
arView.installGestures([.all], for: entity)
Change a rotation of AnchorEntity in RealityKit
Try move(...)
instance method:
import UIKit
import RealityKit
import SceneKit
class ViewController: UIViewController {
@IBOutlet var arView: ARView!
override func viewDidLoad() {
super.viewDidLoad()
let box = try! Experience.loadBox()
let entity = box.steelBox!
DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) {
let currentMatrix = entity.transform.matrix
// Nothing prevents you from using even SceneKit's matrix methods
let rotation = simd_float4x4(SCNMatrix4MakeRotation(.pi/2, 0,1,0))
let transform = simd_mul(currentMatrix, rotation)
entity.move(to: transform, relativeTo: nil, duration: 3.0)
}
arView.scene.anchors.append(box)
}
}
Interact with several ModelEntities
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)
Related Topics
Swiftlint Overriding Project Settings Related to Spm
Does Untimeintervalnotificationtrigger Nexttriggerdate() Give the Wrong Date
Why Does Type(Of:) Return Metatype, Rather Than T.Type
How to Add Multiple Values for One Key in a Dictionary Using Swift
Removing a Closure from an Array
Weak Method Argument Semantics
iOS Swift Didbegincontact Not Being Called
Using @Fetchrequest(Entity: ) for Swiftui MACos App Crashes
How to Subclass a Class Which Doesn't Have Any Designated Initializers
Make a Type Itself -- Not Its Instances -- Conform to a Protocol
Symbol Is Considered to Be an Identifier, Not an Operator
Scenekit Physics Add Velocity in Local Space
Hide Status Bar in Launch Screen
How to Save a Generic Measurement<Unit> in Core Data