Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Multiuser AR Experience を ARKit + Unity で実装する

ねおりん
October 05, 2018

Multiuser AR Experience を ARKit + Unity で実装する

(リアルタイム) Multiuser AR Experience を ARKit + Unity で (比較的簡単に) 実装する方法
主に自作プラグイン https://github.com/noir-neo/UnityARKitMultipeerConnectivity の紹介

デモ動画: https://www.youtube.com/watch?v=DzNEOHz8JwA

ねおりん

October 05, 2018
Tweet

More Decks by ねおりん

Other Decks in Programming

Transcript

  1. Multiuser AR Experience Λ ARKit + Unity Ͱ࣮૷͢Δ 2018/10/5 Unity

    x ARKit ೖ໳ Meetup Ͷ͓ΓΜ (@noir_neo) 1
  2. (ϦΞϧλΠϜ) Multiuser AR Experience Λ ARKit + Unity Ͱ (ൺֱత؆୯ʹ)

    ࣮૷͢Δํ ๏ (ओʹࣗ࡞ϓϥάΠϯͷ঺հ) 3
  3. ֓ཁ • ARKit 2.0 ͱ Multiuser Experience • ࣮૷Ҋ 1.

    UNet 2. ϦΞϧλΠϜ௨৴ήʔϜαʔό 3. MultipeerConnectivity ←ࠓ೔ͷϝΠϯ 4. Cloud Anchors 4
  4. ARKit 2.0 ͷ AR World Map • ෳ਺σόΠεؒͰ AR ੈքΛڞ༗Ͱ͖ΔΑ͏ʹͳͬͨ

    • ͨͩ͠ ARKit ͕ఏڙ͍ͯ͠Δػೳ͸2ͭ • AR ੈքͷอଘɾಡࠐ (serialize / deserialize) • AR ੈքͷ࠶ݱ (relocalize) 6
  5. 1. UNet • Unity ͕ఏڙ͍ͯ͠ΔϚϧνϓϨΠϠʔػೳ • ͷϩʔΧϧ௨৴Λ࢖͏ɺͱ͍͏࿩ • Unity Technologies

    ͷαϯϓϧ1Ͱ΋౰વ࢖ΘΕ͍ͯΔ 1 https:/ /github.com/Unity-Technologies/SharedSpheres 10
  6. 1. UNet Cons • ಉ͡ LAN ʹܨ͕͍ͬͯΔඞཁ͕͋Δ • ARWorldMap (਺ඦKB)ΛૹΔʹ͸޻෉͕ඞཁ

    • νϟϯΫʹͯ͠ૹΔ(ઌड़ͷαϯϓϧʹৄ͘͠ॻ͔Ε͍ͯΔ) • ஈ֊తʹഇࢭ༧ఆ 12
  7. 3. MultipeerConnectivity • iOS Ͱ୺຤ؒ P2P Wi-Fi ΍ Bluetooth ௨৴Λ͢Δ

    framework • Apple ͷ Swift ͷαϯϓϧ2Ͱ࢖͍ͬͯΔ 2 https:/ /developer.apple.com/documentation/arkit/creatingamultiuserarexperience 16
  8. 19

  9. public class ARWorldMapReceiver : MonoBehaviour { [SerializeField] UnityARCameraManager arCameraManager; void

    Start() { UnityMCSessionNativeInterface.GetMcSessionNativeInterface().WorldMapReceivedEvent += Relocalize; } void Relocalize(ARWorldMap worldMap) { UnityARSessionNativeInterface.ARSessionShouldAttemptRelocalization = true; var config = arCameraManager.sessionConfiguration; config.worldMap = worldMap; UnityARSessionRunOption runOption = UnityARSessionRunOption.ARSessionRunOptionRemoveExistingAnchors | UnityARSessionRunOption.ARSessionRunOptionResetTracking; UnityARSessionNativeInterface.GetARSessionNativeInterface() .RunWithConfigAndOptions(config, runOption); } } 20
  10. public static class ARWorldMapSender { public static void SendARWorld() {

    var mcSession = UnityMCSessionNativeInterface.GetMcSessionNativeInterface(); var arSession = UnityARSessionNativeInterface.GetARSessionNativeInterface(); arSession.GetCurrentWorldMapAsync(worldMap => { mcSession.SendToAllPeers(worldMap.nativePtr); }); } } 21
  11. 4. Cloud Anchors • ARCore SDK for Unity ͔Β iOS

    Ͱ΋ར༻Ͱ͖Δ5 • Google ͷαʔόʔ(Firebase)ʹϗετ͢Δ 5 https:/ /developers.google.com/ar/develop/unity/cloud-anchors/quickstart-unity-ios 25
  12. ·ͱΊ • ARKit ʹ͸ AR World Λอଘɾ࠶ݱ͢Δػೳ͕͋Δ͚ͩ • AR World

    Λ Unity Ͱૹड৴͢Δํ๏͸͍͔ͭ͋͘Δ • Ұ௕Ұ୹ͳͷͰཁ݅ʹ߹Θͤͯ࢖͍෼͚·͠ΐ͏ • ۙڑ཭௨৴Λ࢖͏ϓϥάΠϯΛॻ͍͍ͯΔͷͰΑ͚Ε͹ࢼͯ͠ Έ͍ͯͩ͘͞ ✨ • noir-neo/UnityARKitMultipeerConnectivity 27
  13. ωοτϫʔΫ ϥϯχϯάίετ ήʔϜͷ࡞Γ΍͢͞ ϚονϝΠΫ UNet ಉ͡ LAN ʹ͍Δඞ ཁ !

    """ ࣗಈԽՄೳ ϦΞϧλΠϜ௨৴ ήʔϜαʔό Πϯλʔωοτ઀ ଓ # """ ࣮૷͔Ϣʔβ͕େม ʹͳΔ Multipeer Connectivity Wi-Fi ͔ Bluetooth ༗ޮ ! - ࣗಈ Cloud Anchors Πϯλʔωοτ઀ ଓ ! (?) - ࣗಈ (?) 28