Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ARKitに入門して🍣三昧/arsushi_with_arkit_20170721

249b3122eee454c0a818bfe7851418e4?s=47 fromkk
July 21, 2017

 ARKitに入門して🍣三昧/arsushi_with_arkit_20170721

Presentation for iOS Creators' Meetup vol.4

249b3122eee454c0a818bfe7851418e4?s=128

fromkk

July 21, 2017
Tweet

More Decks by fromkk

Other Decks in Programming

Transcript

  1. ARKitʹೖ໳ͯ͠!ࡾດ iOS Creators' Meetup vol.4 1

  2. Profile Kazuya Ueoka Timers inc.ͷiOSΤϯδχΞ Twitter: @fromkk Github: fromkk Qiita:

    fromkk 2
  3. WWDC 2017Ͱൃද͞ΕͨARKit 602 Introducing ARKit: Augmented Reality for iOS 3

  4. AR(Augmented Reality) 4 ֦ுݱ࣮ 4 Χϝϥ!ͰࡱӨͨ͠ө૾ʹ3Dͷ෺ମ౳Λ഑ஔ͢ΔࣄͰݱ࣮ ʹԾ૝తͳ෺ମ͕͍Δ༷ʹݟ͑Δٕज़ 4

  5. ͲΜͳࣄ͕ग़དྷΔ ͔ 4 Made with ARKit 4 Awesome ARKit 5

  6. ͲΜͳΞϓϦʹ޲͍͍ͯΔ͔ 4 ήʔϜ 4 EC౳ͷ෺ൢ 4 ڭҭɾֶशܥ and more... 6

  7. ARKit 4 ϋΠϨϕϧͳAPI 4 iOSରԠ(A9Ҏ্) 4 SceneKit(3D), SpriteKit(2D), Metal(ΧελϜϨϯμϦ ϯά)ରԠ

    4 Կԯ΋ͷσόΠε͕ARKitʹରԠࡁΈ 7
  8. ओཁͳػೳ 4 ϫʔϧυτϥοΩϯάʢಛ௃఺ΛτϥοΩϯάʣ 4 γʔϯͷཧղʢচͷ൑அɾ౰ͨΓ൑ఆɾ໌Δ͞ਪଌʣ 4 ϨϯμϦϯά UnityɾUnrealରԠ 8

  9. Architecture 9

  10. ARSession ARKitͷجຊͱͳΔΫϥε 4 func run(_ configuration: ARSessionConfiguration, options: RunOptions =

    []) 4 ఆظతʹτϥοΩϯά৘ใΛؚΜͩ ARFrame Λ ARSessinoDelegate Ͱड͚औΔࣄ͕ग़དྷΔ 10
  11. ARWorldTrackingSessionConfiguration ݱ࣮ੈքΛτϥοΩϯά͢ΔҝͷઃఆΫϥε 4 class var isSupported: Bool ͰτϥοΩϯάʹରԠ͠ ͍ͯΔ͔൑அ͢Δࣄ͕ग़དྷΔ 4

    var planeDetection: PlaneDetection 4 struct PlaneDetection : OptionSet { static var horizontal: PlaneDetection } 11
  12. ARSCNView ARΛදࣔ͢Δҝʹར༻͢ΔView 4 SCNView Λܧঝ 4 delegate: ARSCNViewDelegate Ͱ ARAnchor

    ͕௥Ճ͞Ε ͨ౳ͷ௨஌Λड͚औΔࣄ͕ग़དྷΔ 12
  13. ౰ͨΓ൑ఆ ARSCNView.hitTest(_ point: CGPoint, types: .ResultType) -> [ARHitTestResult] 13

  14. ARHitTestResult.ResultType 4 featurePoint ࠷΋͍ۙಛ௃఺ 4 estimatedHorizontalPlane ਪఆͷਫฏ໘ 4 existingPlane طଘͷฏ໘ΞϯΧʔ

    4 existingPlaneUsingExtent طଘͷฏ໘ΞϯΧʔͷൣғΛ ར༻͢Δ 14
  15. ͱ͜ΖͰ 15

  16. օ͞Μ!͸޷͖Ͱ͔͢ʁ 16

  17. Ͱ͢ΑͶʁ 17

  18. !͕ແݶʹݱΕΔ༷ͳੈքʹಌΕ·͢ΑͶ" 18

  19. ࡞ͬͯΈ·͠ΐ͏! 19

  20. ؆୯ͳྲྀΕ 4 ARSCNView ʹ SCNScene Λ௥Ճ͢Δ 4 ARSession ͷ run

    ϝυουʹ ARWorldTrackingSessionConfiguration Ληοτ 4 scene.rootNode ʹ SCNNode Λ௥Ճ͍ͯ͘͠ 4 ී௨ʹ UIGestureRecognizer ͕ར༻ग़དྷΔ 20
  21. લఏ৚݅ 4 ΧϝϥΛར༻͢Δҝ Info.plist ʹ NSCameraUsageDescription Λهड़͓ͯ͘͠ 21

  22. demo 22

  23. Recap 4 ؆୯ʹݱ࣮ੈքʹण࢘Λେྔʹ഑ஔ͢Δࣄ͕ग़དྷ·ͨ͠! 4 SceneKit ͷ஌͕ࣝ͋Ε͹৭ʑग़དྷͦ͏" 4 iOS 11ͷϦϦʔεͱڞʹͲͷ༷ͳARKitରԠͷΞϓϦ͕ग़ͯ ͘Δָ͔͠ΈͰ͢Ͷ❗

    4 (ͪͳΈʹ)iPadͷSwift Playground 2(beta)Ͱ΋ಈ͘$ 23
  24. Sample code 4 https://github.com/fromkk/ARSushi 4 https://github.com/fromkk/ ARKitForSwiftPlayground2 24

  25. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠! 25