Skip to content

aheze/ARKitCube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

ARKitCube

Demo app to render a cube with ARKit and SceneKit, from this reddit thread. Each face of the cube is a different color, and a different note is played when they are tapped.

I've ported this project over to SwiftUI. The UIKit code is still available, in Legacy-UIKit.

The main code is in ContentView.swift. The code for porting the ARKit Scene View over to SwiftUI is in ARSCNView.swift.

Features:

  • The cube repeatedly emits a sound, 1Mono.mp3. This uses spatial/positional audio, so when you get closer, the sound is louder. And when you get further away, it gets softer.
  • VoiceOver compatibility - make sure to turn on Direct Touch Mode using the Rotor.
  • Left button - performs hit testing at the exact center point of the screen.
  • Right button - tells you how far away the cube is, in angles (degrees).

Video of the app

Here is a table showing which note will be played for each face that is pressed:

Face number Color Note
0 (front) red 1Do.mp3
1 (right) orange 2Re.mp3
2 (back) yellow 3Mi.mp3
3 (left) green 4Fa.mp3
4 (top) blue 5So.mp3
5 (bottom) purple 6La.mp3