1

is there a way to add installGestures in reality composer?

i am able to do it in code, but i don`t want to mix too much code and ui parts. so i am searching how i can do the drag and drop part in reality composer.

here is the code snipit to do it in code and what i did so far.

arView.installGestures([.translation], for: modelEntity)

does anyone know how to enable this in reality composer?

thanks

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
Auryn
  • 1,117
  • 1
  • 13
  • 37

2 Answers2

2

I solved it with your hin now like this:

let startScene = try! RCProjectFile.loadStartScene()
if let cube = startScene.cube {
    if let cube = cube as? Entity & HasCollision {
        cube.generateCollisionShapes(recursive: true)
        arView.installGestures(for: cube)
    }
}
Auryn
  • 1,117
  • 1
  • 13
  • 37
  • But your question was about Reality Composer, wasn't it? )))) – Andy Jazz Jan 26 '21 at 15:03
  • 1
    yes, i combined both, so i create everything in reality composer and load the scene and make the one object dragable in code. but now i have the issue, that i have muliple scenes that have dragable objects, but i cannot access these scenes from code because they are loaded from another scene. any ideas @andy-fedoroff? Thanks – Auryn Jan 26 '21 at 16:36
1

Reality Composer 1.5 allows you implicitly implement gestures only for animated behaviors. At the moment there's no explicit way to turn on Translation, Rotation or Pinch gestures in Reality Composer. Only via RealityKit, as you indicated.

arView.installGestures([.all], for: entity)

P. S.

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

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220