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
480
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
IaC運用を楽にするためにCDK Pipelinesを導入したけど、思い通りにいかなかった話
smt7174
1
110
WINTICKETアプリで実現した高可用性と高速リリースを支えるエコシステム / winticket-eco-system
cyberagentdevelopers
PRO
1
190
とあるユーザー企業におけるリスクベースで考えるセキュリティ業務のお話し
4su_para
3
320
APIテスト自動化の勘所
yokawasa
7
4.1k
【LT】ソフトウェア産業は進化しているのか? -Javaの想い出とともに- #jjug_ccc
takabow
0
170
初心者に Vue.js を 教えるには
tsukuha
5
390
よくわからんサービスについての問い合わせが来たときの強い味方 Amazon Q について
kazzpapa3
0
220
わたしとトラックポイント / TrackPoint tips
masahirokawahara
1
240
Emacs x Nostr
hakkadaikon
1
150
【技術書典17】OpenFOAM(自宅で極める流体解析)2次元円柱まわりの流れ
kamakiri1225
0
210
一休.comレストランにおけるRustの活用
kymmt90
3
580
2024-10-30-reInventStandby_StudyGroup_Intro
shinichirokawano
1
610
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Designing the Hi-DPI Web
ddemaree
280
34k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
We Have a Design System, Now What?
morganepeng
50
7.2k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
37
1.8k
KATA
mclloyd
29
13k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
The Invisible Side of Design
smashingmag
297
50k
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