ARTetris
Augmented Reality Tetris made with ARKit and SceneKit
We are a development agency building phenomenal apps.
FAQ
App crashes when running on iPhone 6, iPhone 5s, iPad Air, etc.
ARKit only works on devices with A9 chip or greater. So you need at least iPhone 6S or iPad with such a chip.
App runs, but nothing happens.
To play the game you need to find some horizontal surface: floor, table top, etc. Point you camera to a plane and move your device a little bit in different directions to force ARKit to find bounds of the plane. Once it will be found, you will see Tetris well on this plane.
Source Code Guide
- ViewController
- Initialize and configure ARKit
- Detect horizontal plane and initialize Tetris game engine on this plane
- Add gesture recognizers and process gestures
- Tetromino: describe all tetrominos and their rotations
- TetrisConfig: width and height of the well
- TetrisState: tetris game state - current tetromino and its position in the well
- TetrisWell: well model describing filled cells
- TetrisEngine: tetris game engine
- Start game loop
- Handle gestures and change game state
- Handle animation: stop game loop, execute animation, start game loop
- TetrisScene