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
490
ARKit + CoreLocation
totomo1217
1
560
AR mode in Yahoo! MAP
totomo1217
0
2k
ARKit - Nagoya iOS Meetup -
totomo1217
0
150
Other Decks in Technology
See All in Technology
Lexical Analysis
shigashiyama
1
150
Amazon Personalizeのレコメンドシステム構築、実際何するの?〜大体10分で具体的なイメージをつかむ〜
kniino
1
100
20241120_JAWS_東京_ランチタイムLT#17_AWS認定全冠の先へ
tsumita
2
240
信頼性に挑む中で拡張できる・得られる1人のスキルセットとは?
ken5scal
2
530
VideoMamba: State Space Model for Efficient Video Understanding
chou500
0
190
【Startup CTO of the Year 2024 / Audience Award】アセンド取締役CTO 丹羽健
niwatakeru
0
930
複雑なState管理からの脱却
sansantech
PRO
1
140
【若手エンジニア応援LT会】ソフトウェアを学んできた私がインフラエンジニアを目指した理由
kazushi_ohata
0
150
スクラムチームを立ち上げる〜チーム開発で得られたもの・得られなかったもの〜
ohnoeight
2
350
Python(PYNQ)がテーマのAMD主催のFPGAコンテストに参加してきた
iotengineer22
0
470
TypeScriptの次なる大進化なるか!? 条件型を返り値とする関数の型推論
uhyo
2
1.6k
いざ、BSC討伐の旅
nikinusu
2
780
Featured
See All Featured
Building Your Own Lightsaber
phodgson
103
6.1k
Adopting Sorbet at Scale
ufuk
73
9.1k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
860
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
GraphQLとの向き合い方2022年版
quramy
43
13k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
A designer walks into a library…
pauljervisheath
203
24k
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