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
500
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
UI State設計とテスト方針
rmakiyama
2
620
サイバー攻撃を想定したセキュリティガイドライン 策定とASM及びCNAPPの活用方法
syoshie
3
1.3k
コンテナセキュリティのためのLandlock入門
nullpo_head
2
320
20241214_WACATE2024冬_テスト設計技法をチョット俯瞰してみよう
kzsuzuki
3
530
【re:Invent 2024 アプデ】 Prompt Routing の紹介
champ
0
150
5分でわかるDuckDB
chanyou0311
10
3.2k
サービスでLLMを採用したばっかりに振り回され続けたこの一年のあれやこれや
segavvy
2
490
マルチプロダクト開発の現場でAWS Security Hubを1年以上運用して得た教訓
muziyoshiz
3
2.4k
WACATE2024冬セッション資料(ユーザビリティ)
scarletplover
0
210
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
宇宙ベンチャーにおける最近の情シス取り組みについて
axelmizu
0
110
Opcodeを読んでいたら何故かphp-srcを読んでいた話
murashotaro
0
270
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
290
Mobile First: as difficult as doing things right
swwweet
222
9k
For a Future-Friendly Web
brad_frost
175
9.4k
Code Review Best Practice
trishagee
65
17k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
Statistics for Hackers
jakevdp
796
220k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Writing Fast Ruby
sferik
628
61k
Raft: Consensus for Rubyists
vanstee
137
6.7k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
Designing for Performance
lara
604
68k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
98
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