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.5k
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
540
ARKit + CoreLocation
totomo1217
1
580
AR mode in Yahoo! MAP
totomo1217
0
2.1k
ARKit - Nagoya iOS Meetup -
totomo1217
0
160
Other Decks in Technology
See All in Technology
本当に使える?AutoUpgrade の新機能を実践検証してみた
oracle4engineer
PRO
1
120
データプラットフォーム技術におけるメダリオンアーキテクチャという考え方/DataPlatformWithMedallionArchitecture
smdmts
5
550
Definition of Done
kawaguti
PRO
6
460
CSS、JSをHTMLテンプレートにまとめるフロントエンド戦略
d120145
0
200
AWS CDK 実践的アプローチ N選 / aws-cdk-practical-approaches
gotok365
4
460
UIテスト自動化サポート- Testbed for XCUIAutomation practice
notoroid
0
100
成立するElixirの再束縛(再代入)可という選択
kubell_hr
0
790
25分で解説する「最小権限の原則」を実現するための AWS「ポリシー」大全 / 20250625-aws-summit-aws-policy
opelab
6
680
実践! AIエージェント導入記
1mono2prod
0
130
AIにどこまで任せる?実務で使える(かもしれない)AIエージェント設計の考え方
har1101
3
1.2k
Navigation3でViewModelにデータを渡す方法
mikanichinose
0
200
Абьюзим random_bytes(). Фёдор Кулаков, разработчик Lamoda Tech
lamodatech
0
260
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.8k
Into the Great Unknown - MozCon
thekraken
39
1.9k
Being A Developer After 40
akosma
90
590k
Code Review Best Practice
trishagee
68
18k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
228
22k
Rebuilding a faster, lazier Slack
samanthasiow
81
9k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
What's in a price? How to price your products and services
michaelherold
245
12k
Faster Mobile Websites
deanohume
307
31k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.8k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
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