Awesome
<a href="https://exyte.com/"><picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/exyte/media/master/common/header-dark.png"><img src="https://raw.githubusercontent.com/exyte/media/master/common/header-light.png"></picture></a>
<a href="https://exyte.com/"><picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/exyte/media/master/common/our-site-dark.png" width="80" height="16"><img src="https://raw.githubusercontent.com/exyte/media/master/common/our-site-light.png" width="80" height="16"></picture></a> <a href="https://twitter.com/exyteHQ"><picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/exyte/media/master/common/twitter-dark.png" width="74" height="16"><img src="https://raw.githubusercontent.com/exyte/media/master/common/twitter-light.png" width="74" height="16"> </picture></a> <a href="https://exyte.com/contacts"><picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/exyte/media/master/common/get-in-touch-dark.png" width="128" height="24" align="right"><img src="https://raw.githubusercontent.com/exyte/media/master/common/get-in-touch-light.png" width="128" height="24" align="right"></picture></a>
<img align="right" src="https://raw.githubusercontent.com/exyte/ARTetris/master/demo.gif" width="480" /> <p><h1 align="left">ARTetris</h1></p> <p><h4>Augmented Reality Tetris made with ARKit and SceneKit</h4></p>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