Tap / select Node in SceneKit (Swift)

I am new to SceneKit and 3D spaces in iOS. I am currently working on a simple game that shows a cube of 28 segments ("mini-cubes" if you want).

I want to move the mini-cubes by clicking on them, but I cannot figure out how to select specific nodes (children of a large cube).

Can someone help me or post a link to SceneKit tutorials for dummies? I searched for several days and did not find what I was looking for.

Greetings

+6
source share
1 answer

You can click the test to view the scene (for example, from the location of the gesture recognizer), which will give you a list of the results of the shock test. From each result, you can get node (and other information):

let location: CGPoint = // for example from a tap gesture recognizer let hits = self.sceneView.hitTest(location, options: nil) if let tappedNode = hits?.first?.node { // do something with the tapped node ... } 
+14
source

Source: https://habr.com/ru/post/981166/


All Articles