A demo Augmented Reality shooter made with ARKit in Swift (iOS 11)

Overview

ARShooter

License

ARShooter is an open source Augmented Reality shooter made with ARKit and written in Swift. Hence, it is only useable with iOS 11.

For more details on how to get started with ARKit and make your own AR Shooter, take a look at the complementary (and complimentary) tutorial.

status

Requirements

  • Xcode 9
  • iOS 11
  • A9 or better chip for ARWorldTrackingConfiguration

Note: The app automatically detects if your device supports the ARWorldTrackingConfiguration. If not, it will use the less immersive AROrientationTrackingConfiguration, which is supported by all devices.

Communication

  • If you found a bug, open an issue after checking the FAQ.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

Download

Simply navigate to your directory of interest, then clone.

$ git clone https://github.com/farice/ARShooter.git

If you'd like bullets to disappear rather than collect in the space around you, then switch to the bullets-disappear branch

 $ git checkout bullets-disappear

Finally, open the *.xcodeproj file and build to your supported device

FAQ

I am getting the SCNMatrix error:

Cannot invoke initializer for type 'SCNMatrix4' with an argument list of type '(matrix_float4x4)'

Please update to the latest Xcode version (this error is a result of a syntactical change made in Beta 2). If you insist on using Xcode Beta 1, then simply replace SCNMatrix4 with SCNMatrix4FromMat4.


Thanks

ARShooter has been featured by

License

ARShooter is released under the Apache license. See LICENSE for details.

Comments
  • Matrix Error

    Matrix Error

    Just forked and receiving:

    Cannot invoke initializer for type 'SCNMatrix4' with an argument list of type '(matrix_float4x4)'

    Played around a bit with manual init, but not keen on extracting and typing the variables.

    duplicate 
    opened by ajgreen1987 4
  • sound effects enhancement

    sound effects enhancement

    A simple enhancement is adding sound effects using AVFoundation. I added 3 basic sound effects, torpedo.mp3 (bullet sound), explosion.mp3 , collison.mp3.

    sound effects available: torpedo.mp3 explosion.mp3 collision.mp3

    import AVFoundation var Player: AVAudioPlayer = AVAudioPlayer()

    
    // added this basic code snippet in three places just change the forResource for each mp3 name.
    do
            {
               let MusicURL = Bundle.main.path(forResource: "torpedo", ofType: "mp3")
                try Player = AVAudioPlayer(contentsOf: NSURL (fileURLWithPath:MusicURL!) as URL)
                Player.prepareToPlay()
               Player.play()
            }
            catch let error as NSError {
               print(error.description)
           }
    

    1st spot. after

    @IBAction func didTapScreen(_ sender: UITapGestureRecognizer) { // fire bullet in direction camera is facing
    

    2nd spot. after

    
     func removeNodeWithAnimation(_ node: SCNNode, explosion: Bool) {
            
            
            if explosion {
    
    

    3rd spot after

     func physicsWorld(_ world: SCNPhysicsWorld, didBegin contact: SCNPhysicsContact) {
            //print("did begin contact", contact.nodeA.physicsBody!.categoryBitMask, contact.nodeB.physicsBody!.categoryBitMask)
            if contact.nodeA.physicsBody?.categoryBitMask == CollisionCategory.ship.rawValue || contact.nodeB.physicsBody?.categoryBitMask == CollisionCategory.ship.rawValue { // this conditional is not required--we've used the bit masks to ensure only one type of collision takes place--will be necessary as soon as more collisions are created/enabled
                do
                {
    
    

    Thats it!

    enhancement 
    opened by wave-electron 4
  • Remove old

    Remove old "bullets"

    Is there a way to remove old bullet nodes? I have been looking around the project and can't seem to figure out how to do it. Without this functionality, there are a bunch of "bullets" flying around.

    enhancement alt-branch 
    opened by schenkty 3
  • iPhone5s crash

    iPhone5s crash

    2017-06-07 18:40:19.329904+0800 ARViewer[771:115352] -[MTLTextureDescriptorInternal validateWithDevice:], line 778: error 'MTLTextureDescriptor has invalid pixelFormat (520).' -[MTLTextureDescriptorInternal validateWithDevice:]:778: failed assertion `MTLTextureDescriptor has invalid pixelFormat (520).'

    on iPhone5s , but iPhone5s simulator is ok

    To be fixed by Apple hardware 
    opened by TeacherXue 3
  • Camera Transform Matrix Values

    Camera Transform Matrix Values

    Hi, I was looking for ways to implement projectiles in my ARKit project and stumbled across your ViewController. I saw that in the method getUserVector, the direction property was set based on positions: m31, 32, and 33 of the camera transform matrix and I was wondering how you figured this out. I wasn't able to find it anywhere I looked in any documentation, article or video. Is there some sort of documentation on the properties of this matrix you found? Sorry to open a new issue. I hope I'm not bugging you, I was just insanely curious about that one line (which helped me a lot, thank you!).

    Cheers, Harry

    opened by hmerzin 2
  • Open the project,Prompt bug:Cannot invoke initializer for type 'SCNMatrix4' with an argument list of type '(matrix_float4x4)'

    Open the project,Prompt bug:Cannot invoke initializer for type 'SCNMatrix4' with an argument list of type '(matrix_float4x4)'

    Open the project, Prompt bug:Cannot invoke initializer for type 'SCNMatrix4' with an argument list of type '(matrix_float4x4)'... Can you see?A great god

    duplicate 
    opened by wangyi1998 2
  • Tranform matrix help

    Tranform matrix help

    Awesome Repo. Thanks! I'm looking for some more information around the "getUserVector()" method.

    Firstly -- SCNMatrxi4.mat31, mat32, mat33, etc. are not available anymore. Xcode shows me that I must use SCNMatrix4.columns.1.x, which Is confusing -- I don't know how to convert to the m31 matrix syntax with the new columns approach.

    My main issue is that I'm having a real hard time finding in the Apple docs what exactly all 16 elements represent in the 4x4 transform matrices, for example the ARcamera.transform matrix. How did you know that m31, m32, and m33 are the orientation of the camera, and that m41, m42, m43 are the position? Lastly, as mentioned above -- these coordinates would need to be converted to the new columns.0.y syntax, which again seem to be poorly documented in any apple doc. I feel like I'm missing some holy grail for Matrix Transforms from apple.

    Thank you so much!

    func getUserVector() -> (SCNVector3, SCNVector3) { // (direction, position)
    
      if let frame = self.sceneView.session.currentFrame {
      let mat = SCNMatrix4(frame.camera.transform) // 4x4 transform matrix describing camera in world space
      let dir = SCNVector3(-1 * mat.m31, -1 * mat.m32, -1 * mat.m33) // orientation of camera in world space
      let pos = SCNVector3(mat.m41, mat.m42, mat.m43) // location of camera in world space 
       return (dir, pos)
      }
       return (SCNVector3(0, 0, -1), SCNVector3(0, 0, -0.2))
    }
    
    opened by enjoiful 1
  • Error SCNMatrix4(frame.camera.transform)

    Error SCNMatrix4(frame.camera.transform)

    let mat = SCNMatrix4(frame.camera.transform) // 4x4 transform matrix describing camera in world space

    Error: Cannot invoke initializer for type 'SCNMatrix4' with an argument list of type '(matrix_float4x4)'

    I get this error when I try to build your project on my machine.

    opened by ghost 1
Releases(v1.0-xcode2)
Owner
Faris Sbahi
QML researcher at Alphabet X. Quantum algorithms, information geometry, and statistical learning theory. Formerly, Google AI / Duke Physics/Math.
Faris Sbahi
Augmented Reality image tracking with SwiftUI, RealityKit and ARKit 4.

ARImageTracking This is an Augmented Reality Xcode project that uses Apple's newest RealityKit framework and ARKit 4 features, to dynamically track a

Richard Qi 198 Dec 7, 2022
ARID - Augmented Reality app using Apple’s ARKit framework which can recognise faces of famous scientists

ARID Augmented Reality app using Apple’s ARKit framework which can recognise fac

Hemanth 0 Jan 12, 2022
ARDicee - Simple augmented reality app using SceneKit and ARKit

ARDicee Simple augmented reality app using SceneKit and ARKit Requirements Xcode

donggyu 3 Feb 4, 2022
Develop simple and fun Augmented Reality (AR) iOS apps

AR-Dice Simple and fun to use iOS app made to make Augmented reality (AR) be in

Dishant Nagpal 1 Feb 23, 2022
Smart Online Shopping iOS App with Augmented Reality (AR) and simple Social Media features using SwiftUI and Google Firebase Cloud Services

Table of contents App Demo How to Run Context Content How it's written Inspiration App Demo AR.online.shopping.iOS.demo.mp4 How to Run First make sure

Ashkan Goharfar 13 Nov 1, 2022
Browse the streets of Los Angeles on an Augmented Reality historical walking tour.

Ruscha AR 0.3 Browse the streets of Los Angeles on an Augmented Reality historical walking tour. Explore Hollywood through the photos of Ed Ruscha. Th

Rick van Voorden 2 Jul 9, 2022
It is a music and podcast creation system that enables users to create multiple tracks using AR(Augmented Reality).

AR-Studio It is a music creation system enables users to create multiple tracks using AR(Augmented Reality). Introduction AR Studio turns your iPad, a

Ayush Singh 5 Dec 3, 2022
An augmented reality (AR) ghost hunting simulation for iPhone

ARanormal An augmented reality (AR) ghost hunting simulation for iPhone About ARanormal was the first game by Jesdo Software, released for iPhone in O

Jesse Douglas 1 Nov 2, 2021
Placing Virtual Objects in Augmented Reality

Placing Virtual Objects in Augmented Reality Learn best practices for visual feedback, gesture interactions, and realistic rendering in AR experiences

Yuchao 279 Dec 11, 2022
AR Ruler - A simple iOS app made using ARKit and SceneKit

A simple iOS app made using ARKit and SceneKit.Which can try to simplify little things in your life such as measuring stuff.

Dishant Nagpal 5 Aug 31, 2022
ARKit Demo Application

ARKitNavigationDemo Work in progress. In Progress Region — For one, we could render far fewer nodes. In fact, it’s a bit distracting that the entire t

Christopher Webb 296 Dec 16, 2022
PlacenoteSDK Sample app in native iOS using ARKit, written primarily in Swift

Placenote SDK for iOS Placenote SDK lets you easily build cloud-based Augmented Reality (AR) apps that pin digital content to locations in the real wo

Placenote 93 Nov 15, 2022
An iOS Framework Capture & record ARKit videos 📹, photos 🌄, Live Photos 🎇, and GIFs 🎆.

An iOS Framework that enables developers to capture videos ?? , photos ?? , Live Photos ?? , and GIFs ?? with ARKit content.

Ahmed Bekhit 1.5k Dec 24, 2022
IOS example app to generate point clouds in ARKit using scenedepth

Visualizing a Point Cloud Using Scene Depth Place points in the real-world using the scene's depth data to visualize the shape of the physical environ

Isak Diaz 20 Oct 31, 2022
ARKit + CoreLocation: Combines the high accuracy of AR with the scale of GPS data.

ARKit: Uses camera and motion data to map out the local world as you move around. CoreLocation: Uses wifi and GPS data to determine your global locati

Andrew Hart 5.3k Dec 27, 2022
ARKit Base Project. Place virtual objects based on WWDC example project

ARKit - Placing Virtual Objects in Augmented Reality Learn best practices for visual feedback, gesture interactions, and realistic rendering in AR exp

Ignacio Chiazzo Cardarello 338 Jan 5, 2023
A library that allows you to generate and update environment maps in real-time using the camera feed and ARKit's tracking capabilities.

ARKitEnvironmentMapper Example To run the example project, clone the repo, and run pod install from the Example directory first. Installation ARKitEnv

SV Hawks 91 Dec 4, 2022
This library uses ARKit Face Tracking in order to catch user's smile.

SmileToUnlock Make your users smile before opening the app :) Gif with the demonstration Installation Cocoapods The most preferable way to use this li

Ruslan Serebriakov 628 Oct 22, 2022
Power! Unlimited power for ARKit 2.0!

A long time ago in a galaxy, far, far away... It is a period when iPhone SE and iPhone X were destroyed from the apple store, the AR market was under

KBOY (Kei Fujikawa) 516 Dec 1, 2022