Slide 1

Slide 1 text

2017/06/21 ARKitʹ৮ͬͯݟͨ݁Ռ ໘ന͍ൃද͕Ͱ͖Δ͔ͱࢥͬͨͷ͕ͩ ͦΜͳ͜ͱແ͔ͬͨ… Ͱ΋ؤுͬͯLT͢Δ࿩ WWDC After Party 2017 @Ebisu

Slide 2

Slide 2 text

About Me

Slide 3

Slide 3 text

• ాத ޹໌ (Takaaki Tanaka) • Ϋϥεϝιουגࣜձࣾ • @kongmingtrap • Swift / Objective-C / Scala / JavaScript … • GyazSquare / GitHub

Slide 4

Slide 4 text

WWDC

Slide 5

Slide 5 text

WWDC • ॳWWDC • ॳւ֎ • ӳޠ…?

Slide 6

Slide 6 text

WWDC • ฐࣾͷฏ԰ਅޗ͞Μ͕WWDC 2015ʹࢀՃ • ಉ͘͡ࢀՃ͍ͯͨ͠ࢣঊ͕ฏ԰ਅޗ͞Μͱ ᬍ᫯ • Ϋϥεϝιου͕ΤϯδχΞΛืू͍ͯ͠ Δ͜ͱΛ஌Δ • Ϋϥεϝιου΁స৬Λܾҙ

Slide 7

Slide 7 text

ؓ࿩ٳ୊

Slide 8

Slide 8 text

WWDC17

Slide 9

Slide 9 text

Main topic • ARKit • eGPUKit • Core ML • Home Kit • HomePod

Slide 10

Slide 10 text

Main topic • ARKit • eGPUKit • Core ML • Home Kit • HomePod

Slide 11

Slide 11 text

AR

Slide 12

Slide 12 text

AR

Slide 13

Slide 13 text

WWDC

Slide 14

Slide 14 text

Demo IUUQTXXXZPVUVCFDPNXBUDI WN$P6YH0P. IUUQTJUVOFTBQQMFDPNKQBQQVGPDBNFSBE JE NU

Slide 15

Slide 15 text

AR • AVFoundation • Core Location • Heading • Core Motion • Gyro scope • Accelerometer

Slide 16

Slide 16 text

AR • AVFoundation • Core Location • Core Motion • Gyro scope • Accelerometer

Slide 17

Slide 17 text

AR $FMFTUJBM0CTFSWBUJPO7JFXFS

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

ARKit • ARKit • SceneKit

Slide 21

Slide 21 text

ARKit • ARKit • SceneKit

Slide 22

Slide 22 text

ARSession • ΧϝϥػೳɺϞʔγϣϯݕ஌ͳͲแׅͯ͠ ߦ͏manager object (shared) • ैདྷͷํ๏ͩͱɺόοςϦʔফඅ͕ܹ͔ͬ͠ ͕ͨɺframeworkϨϕϧͰ࠷దԽ͍ͯ͠Δ ʢΒ͍͠ʣ

Slide 23

Slide 23 text

ARSession

Slide 24

Slide 24 text

ARSession

Slide 25

Slide 25 text

Plane Detection

Slide 26

Slide 26 text

Plane Detection // configure session if let worldSessionConfig = sessionConfig as? ARWorldTrackingSessionConfiguration { worldSessionConfig.planeDetection = .horizontal session.run(worldSessionConfig, options: [.resetTracking, .removeExistingAnchors]) }

Slide 27

Slide 27 text

ARAnchor • ARPlaneAnchor • ARAnchorͷαϒΫϥε • ݕग़͞Εͨฏ໘ • ݕग़͞ΕͨΒARSCNViewDelegateͷϝιου ʹ௨஌͞ΕΔ • renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor)

Slide 28

Slide 28 text

ARSCNViewDelegate func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) { DispatchQueue.main.async { if let planeAnchor = anchor as? ARPlaneAnchor { self.addPlane(node: node, anchor: planeAnchor) self.checkIfObjectShouldMoveOntoPlane(anchor: planeAnchor) } } }

Slide 29

Slide 29 text

ARPlaneAnchor + SCNNode func addPlane(node: SCNNode, anchor: ARPlaneAnchor) { let pos = SCNVector3.positionFromTransform(anchor.transform) textManager.showDebugMessage("NEW SURFACE DETECTED AT \ (pos.friendlyString())") let plane = Plane(anchor, showDebugVisuals) planes[anchor] = plane node.addChildNode(plane) textManager.cancelScheduledMessage(forType: .planeEstimation) textManager.showMessage("SURFACE DETECTED") if virtualObject == nil { textManager.scheduleMessage("TAP + TO PLACE AN OBJECT", inSeconds: 7.5, messageType: .contentPlacement) } }

Slide 30

Slide 30 text

ARPlaneAnchor + SCNNode func updatePlane(anchor: ARPlaneAnchor) { if let plane = planes[anchor] { plane.update(anchor) } }

Slide 31

Slide 31 text

ARPlaneAnchor + SCNNode private func updateOcclusionNode() { guard let occlusionNode = occlusionNode, let occlusionPlane = occlusionNode.geometry as? SCNPlane else { return } occlusionPlane.width = CGFloat(anchor.extent.x - 0.05) occlusionPlane.height = CGFloat(anchor.extent.z - 0.05) occlusionNode.position = SCNVector3Make(anchor.center.x, occlusionPlaneVerticalOffset, anchor.center.z) }

Slide 32

Slide 32 text

Recap • ฏ໘ݕग़ʢਫฏํ޲ʣͷΈ • ARΑΓ΋ฏ໘ݕग़ػೳͷํ͕ϝΠϯ • Ϟʔγϣϯͷ௥ै͸ࠓޙʹظ଴ • όοςϦʔফඅʹؔͯ͠͸ܭଌͯ͠Έ͍ͨ

Slide 33

Slide 33 text

WWDC17 IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZ XXED *OUSPEVDJOH"3,JU"VHNFOUFE3FBMJUZGPSJ04

Slide 34

Slide 34 text

Thank you!