Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ARKit + CoreLocation - Bonfire iOS #4 -
Search
totomo
May 15, 2018
Technology
5
1.4k
ARKit + CoreLocation - Bonfire iOS #4 -
Talked about ARKit + CoreLocation.
This session was focused to the UI.
totomo
May 15, 2018
Tweet
Share
More Decks by totomo
See All by totomo
Yahoo! MAPにおけるARの活用事例 - FOSS4G Tokai 2018 -
totomo1217
1
400
ARKit + CoreLocation
totomo1217
1
550
AR mode in Yahoo! MAP
totomo1217
0
1.8k
ARKit - Nagoya iOS Meetup -
totomo1217
0
130
Other Decks in Technology
See All in Technology
MapLibreとAmazon Location Service
dayjournal
1
160
現代CSSフレームワークの内部実装とその仕組み
poteboy
7
3.6k
GraphQL 成熟度モデルの紹介と、プロダクトに当てはめた事例 / GraphQL maturity model
mh4gf
7
1.3k
ChatGPT for IT Service Management (IT Pro)
dahatake
7
1.6k
家族アルバム みてねにおけるGrafana活用術 / Grafana Meetup Japan Vol.1 LT
isaoshimizu
1
770
アクセス制御にまつわる改善 / Improving access control
itkq
0
550
自己改善からチームを動かす! 「セルフエンジニアリングマネージャー」のすゝめ
shoota
6
780
地理空間データ可視化・解析・活用ソリューション Pacific Spatial Solutions (PSS)
pacificspatialsolutions
0
290
SIEMを用いて、セキュリティログ分析の可視化と分析を実現し、PDCAサイクルを回してみた
coconala_engineer
0
330
DevOpsメトリクスとアウトカムの接続にトライ!開発プロセスを通して計測できるメトリクスの活用方法
ham0215
2
240
20分で完全に理解するGrafanaダッシュボード
hamadakoji
3
670
ワールドカフェI /チューターを改良する / World Café I and Improving the Tutors
ks91
PRO
0
120
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
36
2.1k
We Have a Design System, Now What?
morganepeng
43
6.8k
Side Projects
sachag
451
41k
Making the Leap to Tech Lead
cromwellryan
124
8.5k
A Tale of Four Properties
chriscoyier
151
22k
Done Done
chrislema
178
15k
From Idea to $5000 a Month in 5 Months
shpigford
377
45k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
125
32k
Gamification - CAS2011
davidbonilla
76
4.6k
How GitHub (no longer) Works
holman
304
140k
A designer walks into a library…
pauljervisheath
200
23k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
14
1.5k
Transcript
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. Bonfire
iOS #4 20185݄15 Kenta Tokumoto ARKit+CoreLocation
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 2
Outline • ࣗݾհ • ARϞʔυʹ͍ͭͯ • ARKitͷ֓ཁ • ARKit+CoreLocation • ΦϒδΣΫτͷஔํ๏ʹ͍ͭͯ • ϧʔτϥΠϯ • ൘ • • ͚Μ͘͞+ΰʔϧϐϯ • ۭؒิਖ਼ • ARͱਤͰͷUIͷҧ͍ʹ͍ͭͯ
About me ,FOUB5PLVNPUP 5XJUUFSUPUPNP (JUIVCUPUPNP 2JJUBUPUPNP ໊ݹۈɺೖࣾ̒ :BIPP."1ͷJ04 8FC"1*։ൃ୲ 3
AR mode? 4 • Yahoo! MAPΞϓϦ(iOS)Ͱఏڙ͍ͯ͠ΔARΛͬͨ ెาφϏࢧԉػೳ • iOS 11͔Βར༻ՄೳͳARKitΛ༻
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 5
Team Product Manager Designer Engineer
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 6
Schedule 20179݄ʙ 12݄ 1݄ 2݄ 3݄ ϧʔτϥΠϯɺ ࣮ݧ ൘ɺ͚Μ͘͞ QAɺਃ ۭؒิਖ਼ ϦϦʔε
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 7
ARKit • iOS 11Ҏ߱Ͱ͑ΔARػೳΛ࣮͢Δͷʹศ རͳFramework • AR modePosition TrackingΛඞཁͱ͢ΔͨΊ A9νοϓ͕ࡌ͞ΕͨͷΈαϙʔτ • Android → ARCore
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 8
ARKit+CoreLocation • ARConfiguration.worldAlignment.gravit yAndHeadingΛࢦఆ͢Δ • ݪͷҐஔใͱARKitʹΑΓߏங͞Ε ͨੈքۭؒͷݪ૬ޓมՄೳ AR ࣮ۭؒ N N (x n , z n ) (lat n , lon n )
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 9
ARKit+CoreLocation (0, 0) d [m] (x 1 , z 1 ) (lat 0 , lon 0 ) d [m] (lat 1 , lon 1 )
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 10
SCNNodeͷஔ • ϧʔτϥΠϯ (SCNPlane) • ൘ (3D) • ͚Μ͘͞+ΰʔϧϐϯ(3D) • (SCNPlane)
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 11
ϧʔτϥΠϯ
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 12
ϧʔτϥΠϯ position eulerAngles.y
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 13
൘
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 14
൘ position
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 15
൘ position
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 16
൘ position • ϚʔδϯΛઃ͚ͯݟ͍͢ํʹճస • ౦ͲͪΒʹஔ͢Δ͔ɺਐߦํ ͱ࣍ͷํͱͷ͔ࠩΒஅ͍ͯ͠Δ
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 17
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 18
position
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 19
position • ARSCNView͔ΒऔΕΔ pointOfViewͷpositionΛऔಘ • ݱࡏҐஔͷ࠲ඪΛͱʹҠಈڑ ͱ֯Λܭࢉ • ϥϯμϜͰग़͢Α͏ʹ materialʹઃఆ͍ͯ͠ΔUIImageΛ ಈతʹઃఆ͍ͯ͠Δ
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 20
͚Μ͘͞+ΰʔϧϐϯ position SCNBillboardConstrain t
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 21
SCNNodeͷՃ locationInfoProvider.location { [weak self] location in guard let origin = location else { self?.displayError() return } self?.addObjects(origin: origin) }
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 22
ஞ࣍తͳSCNNodeͷՃ func renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval) { // 5ͭͣͭՃ͢Δ } self.navigationView.worldNode.addScheduledNodes(quantity: 5) func addObjects(origin: CLLocation) { self.navigationView.origin = origin let routeLineNodes = routeNodes(withCoordinates: self.coordinates) self.navigationView.scheduleNodes(routeLineNodes, priority: .high) } // ARSCNViewDelegate
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 23
ۭؒิਖ਼ Correctable Space Fixed Space Root Space
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. ۭؒิਖ਼
24 • Fixed Space • • Correctable Space • ϧʔτϥΠϯ • ͚Μ͘͞&ΰʔϧϐϯ • ൘
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. ۭؒิਖ਼
25 GPSʹΑΔݱࡏ (CoreLocation) AR্ۭؒͷΧϝϥͷݱࡏ (ARKit) GPSʹΑΔޡࠩͷܘ
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. ۭؒิਖ਼
26 GPSʹΑΔݱࡏ (CoreLocation) AR্ۭؒͷΧϝϥͷݱࡏ (ARKit) GPSʹΑΔޡࠩͷܘ ޡࠩͷԁ͔ΒΈग़ͯ͠ ͍Δ
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 27
LocationInfoProvider public protocol LocationInfoProvidable { func location(completion: @escaping (CLLocation?)->()) func nearbyRoutePoint(from origin: SCNVector3) -> SCNVector3? var delegate: LocationInfoProviderDelegate? { get set } } protocol LocationInfoProviderDelegate: class { // ֯ิਖ਼ (ిࢠίϯύε·ͨҐஔใͷਫ਼্͕ͨ͠λΠϛϯάͰ௨) // ਫ਼: heading.headingAccuracy func locationInfoProvider(_ provider: LocationInfoProvidable, requestUpdateHeading heading: CLHeading) // Ґஔิਖ਼ (Ґஔใͷਫ਼্͕ͨ͠λΠϛϯάͰ௨ // ਫ਼: location.horizontalAccuracy func locationInfoProvider(_ provider: LocationInfoProvidable, requestUpdateLocation location: CLLocation, oldLocation: CLLocation?) }
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. ۭؒิਖ਼
28 extension ARRouteNavigationViewController: ARLocationInfoProviderDelegate { public func arLocationInfoProvider(_ provider: ARLocationInfoProvidable, requestUpdateLocation location: CLLocation, oldLocation: CLLocation?) { guard let origin = navigationView.origin, let currentPosition = navigationView.pointOfView?.worldPosition else { return } ɹɹɹɹɹ// GPS͔Βܭࢉͨ͠ARۭؒʹ͓͚Δ࠲ඪ ɹɹɹɹɹlet gpsPosition = location.coordinate.relativeVector3(to: origin.coordinate) + ɹɹɹɹɹ navigationView.worldNode.correctableNode.worldPosition ɹɹɹɹɹ// GPSͷޡࠩΛ͑ͯͣΕ͍ͯͳ͍߹Կ͠ͳ͍ ɹɹɹɹɹguard idealPosition.length(between: currentPosition) > location.horizontalAccuracy else { ɹɹ return ɹɹɹɹɹ} ɹɹɹɹɹ// ޡࠩΛܭࢉ ɹɹɹɹɹlet positionDifference = gpsPosition – currentPosition ɹɹɹɹɹ// ิਖ਼ ɹɹɹɹɹnavigationView.worldNode.correctableNode.worldPosition -= SCNVector3(positionDifference.x, 0, positionDifference.z) } }
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. ARͱਤͰͷφϏήʔγϣϯͷҧ͍
29 • ՄࢹྖҬ • ۭؒͱ࣍ݩ
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. ՄࢹྖҬͷҧ͍
30 • ՄࢹྖҬ • ਤɹ →ɹશମΛ၆ᛌͯ͠ݟΕΔ • ARɹ →ɹपลʹϑΥʔΧεͯ͠ݟΔ
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. ՄࢹྖҬͷҧ͍ͷରࡦ
31 ํࢦࣔΛࡉ͔͘දࣔ ൘ͰํͱΓͷڑΛࡉ͔͘දࣔ
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. ۭؒͱ࣍ݩͷҧ͍
32 • ۭؒͱ࣍ݩ • ਤɹ →ɹਤʹΑΔ2࣍ݩۭؒ ɹɹɹɹɹ (ݱ࣮Λ2Dʹͯ͠Ճͨ͠ͷ) • ARɹ →ɹݱ࣮ۭؒ (3D)
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. ࣍ݩͷҧ͍ͷରࡦ
33 • يɹɹɹ →ɹ • ਧ͖ग़͠ɹ →ɹ൘ • ΰʔϧϐϯ →ɹ͚Μ͘͞(ͱΰʔϧϐϯ)
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. ਤͱARΛγʔϜϨεʹซ༻͢Δ
34 1λοϓͰ͙͢Γସ͑ΒΕΔΑ͏ʹ
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 35
·ͱΊ • ARKit + CoreLocation Ͱ࣮ࡍͷ෩ܠΛݟͳ͕ΒಓҊ͕Ͱ͖Δ • ARKit͕ߏ͢Δۭؒ࠲ඪͱ࣮ۭؒͷҢܦ૬ޓʹม͢Δ͜ ͱ͕Ͱ͖Δ • 3DΦϒδΣΫτͷஔʹSceneKitͷ͕ࣝඞཁ • GPSిࢠίϯύεͷਫ਼ΛݟͭͭΧϝϥͷ࠲ඪ͔ΒҐஔํ Λิਖ਼Մೳ • ARͱਤͰಛੑ͕ҧ͏ͨΊUIͦΕͧΕʹ߹ΘͤΔඞཁ͕͋Δ
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. Fin