Giter Site home page Giter Site logo

magicleap / xr-kit-samples-unity Goto Github PK

View Code? Open in Web Editor NEW
26.0 14.0 11.0 132.48 MB

Magicverse SDK sample project

License: Other

C# 95.87% Objective-C++ 0.12% Objective-C 1.71% ShaderLab 0.71% C++ 1.59%
magicverse spatial anchors multi-user cross-platform shared

xr-kit-samples-unity's Introduction

Magicverse 101

Copyright 2019-2020 Magic Leap, Inc. All rights reserved.

Created on and tested with :

  • Unity 2019.3.5f1
  • Lumin SDK 0.24
  • Lumin OS 0.98.10
  • Xcode Version 11.3.1 (11C504)
  • iOS Version 13.3.1
  • Android 10

Overview

This example shows how to create a Magicverse enabled Unity project that anchors content to Magic Leap created PCFs and transmits that content across a peer to peer local area network. This enables other devices running either an XR Kit enabled version of the app on iOS or Android, or other Magic Leap devices with the same app to see the same content. The opposite is also shown, where an XR Kit enabled iOS or Android app can place a cube attached to an Anchor and it will appear on peer Magic Leap, iOS, and Android devices as well.

Getting started

This project contains one file that is stored in LFS since it is too large: https://github.com/magicleap/xr-kit-samples-unity/blob/master/Magicverse101/Packages/MagicLeapXRKit/Runtime/Native/iOS/libmlxr_runtime_s.a

So to get started on this project, git clone the repo to a folder in your hard drive, then cd into that folder and run the git lfs pull command to pull down the full file.

Caveat: if you use the "Download Zip" button above, the zip will only contain the lfs link and not the full file.

Implementation notes

Note: This code uses a modified version of the MLTK Transmission API. A new overloaded version of Transmission.Spawn API has been added which takes a PCFID/XRAnchor string as a parameter. If this parameter exists, the passed position and rotation will be used as a local offset to the given PCF (rather than to the current user’s headpose). It is used to spawn a resource from the resource folder on all peers and set the newly spawned object as a child of a PCF.

The Unity project contains a cross platform codebase and can be compiled and ran on Lumin, iOS, and Android.

Note: For iOS and Android, this sample project uses XR Kit for Unity, and will require the developer to obtain OAuth credentials and populate them in the project as described in the documentation there.

The code includes an example main MVPlacementExample which manages the Input and calls our modified Transmission.Spawn to spawn an Anchor/PCF attached game object across all peers on the network.

PCFSystem handles management of both the PCFs (on Lumin) and Anchors (on iOS or Android).

PCFAnchorVisual maintains the text strings seen in space. These will only be visible if the checkbox is checked on PCFSystem and if PCFSystem has a prefab with PCFAnchorVisual attached to it.

There are two scenes, one for Lumin and another for iOS and Android. Select the correct scene for the correct build target, set up OAuth credentials and away you go! Experience the Magicverse…

License

See details in license.md

xr-kit-samples-unity's People

Contributors

magic-jimmy avatar rogerawong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xr-kit-samples-unity's Issues

XCode for iOS build failed

Hello mates,
Thank for sharing your project,
I have tried this project on Magic Leap glass and it work perfectly, but currently i am having error while trying to build XCode for iOS. No matter what setting i tried it always failed with these error:
ld: warning: ignoring file /Users/admin/Documents/XCode/MagicLeap/XRKitSample/XCode/Libraries/com.magicleap.xrkit/Runtime/Native/iOS/libmlxr_runtime_s.a, building for iOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x20 0x68 0x74 0x74 0x70 0x73 0x3A 0x2F 0x2F ) Undefined symbols for architecture arm64: "_MLXrBackendSessionGetLocalizationStatus", referenced from: _Bindings_MLXrBackendSessionGetLocalizationStatus_m5AB086F54FEEE526939EDD8F7781200FBF0D9AE1 in MLXR-ios.o _MLXRSession_Impl_IsLocalized_mCEB1C5E8DC4779ECA41744BF4D110AC2E59E8E34 in MLXR-ios.o _MLXRSession_Impl_GetLocalizationStatus_m9504791CC3BCD822E3B3F2F98ED715136ACD794B in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendSessionGetLocalizationStatus_m5AB086F54FEEE526939EDD8F7781200FBF0D9AE1) "_MLXrBackendSessionGetAnchorByPcfId", referenced from: _Bindings_MLXrBackendSessionGetAnchorByPcfId_m59AD204F72363E013FE65991F7B6A9DEC5A601EB in MLXR-ios.o _MLXRSession_Impl_GetAnchorByIdNative_mC883B51C5493073B7C6503900EB8FEC184AAD382 in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendSessionGetAnchorByPcfId_m59AD204F72363E013FE65991F7B6A9DEC5A601EB) "_MLXrBackendSessionGetAllAnchors", referenced from: _Bindings_MLXrBackendSessionGetAllAnchors_mFB8263440AE8462B7D3BDFF5A47359715D2A594E in MLXR-ios.o _MLXRSession_Impl_GetAllAnchorsFromNative_mF8B5941109B3EB88F0286E05074D0165317C2EDD in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendSessionGetAllAnchors_mFB8263440AE8462B7D3BDFF5A47359715D2A594E) "_MLXrBackendSessionCreateFrame", referenced from: _Bindings_MLXrBackendSessionCreateFrame_m97DF507F9B197E7FE64B509FB32CC9E7B0CC1401 in MLXR-ios.o _MLXRSession_Impl_TryUploadImage_m56CB625D0DFDA47D5CB6FDD86765C2F08CB3C136 in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendSessionCreateFrame_m97DF507F9B197E7FE64B509FB32CC9E7B0CC1401) "_MLXrBackendSessionGetStatus", referenced from: _Bindings_MLXrBackendSessionGetStatus_mC26F445AB0F92B07B3BF0DFA9ED4074018DFFE6B in MLXR-ios.o _MLXRSession_Impl_IsConnected_m47A3F215841E3BF26A87FA499FD88C8F326BF033 in MLXR-ios.o _MLXRSession_Impl_GetSessionStatus_m570E43567A57D4322B0AEC309140FBECE8CB01AD in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendSessionGetStatus_mC26F445AB0F92B07B3BF0DFA9ED4074018DFFE6B) "_MLXrBackendSessionCreate", referenced from: _Bindings_MLXrBackendSessionCreate_m271A00ACA45C5FE06A461490B4660E33D7D5E3CE in MLXR-ios.o _MLXRSession_Impl_StartSession_m4C180CB296718FBBCE2786645BE8FC913F07BFCE in MLXR-ios.o (maybe you meant: Bindings_MLXrBackendSessionCreateFrame_m97DF507F9B197E7FE64B509FB32CC9E7B0CC1401, Bindings_MLXrBackendSessionCreate_m271A00ACA45C5FE06A461490B4660E33D7D5E3CE ) "_MLXrBackendFrameIsReadyForImage", referenced from: _Bindings_MLXrBackendFrameIsReadyForImage_mD289281F8CF8DE6574F3ECDB62E3BEC3BA68BE5A in MLXR-ios.o _MLXRSession_Impl_TryUploadImage_m56CB625D0DFDA47D5CB6FDD86765C2F08CB3C136 in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendFrameIsReadyForImage_mD289281F8CF8DE6574F3ECDB62E3BEC3BA68BE5A) "_MLXrBackendFrameSetLocation", referenced from: _Bindings_MLXrBackendFrameSetLocation_mA8841EC7BB3A4FF9318313B776BF549EBB26DDAF in MLXR-ios.o _MLXRSession_Impl_TryUploadImage_m56CB625D0DFDA47D5CB6FDD86765C2F08CB3C136 in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendFrameSetLocation_mA8841EC7BB3A4FF9318313B776BF549EBB26DDAF) "_MLXrBackendAnchorGetPCFId", referenced from: _Bindings_MLXrBackendAnchorGetPCFId_m04473812C4EEDEA9214CF9F4C94754F7E9E20563 in MLXR-ios.o _MLXRSession_Impl_ToAnchor_m953B6BD80AEA383678113CEE0F4465F3F61BC897 in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendAnchorGetPCFId_m04473812C4EEDEA9214CF9F4C94754F7E9E20563) "_MLXrBackendFrameSetCameraFrameData", referenced from: _Bindings_MLXrBackendFrameSetCameraFrameData_m28DA3A41C4E18002A151AEC26935108EBB89D5EC in MLXR-ios.o _MLXRSession_Impl_TryUploadImage_m56CB625D0DFDA47D5CB6FDD86765C2F08CB3C136 in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendFrameSetCameraFrameData_m28DA3A41C4E18002A151AEC26935108EBB89D5EC) "_MLXrBackendFrameUpdate", referenced from: _Bindings_MLXrBackendFrameUpdate_mFDA809716E2DB730FED2E96F6039A53756425FA6 in MLXR-ios.o _MLXRSession_Impl_TryUploadImage_m56CB625D0DFDA47D5CB6FDD86765C2F08CB3C136 in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendFrameUpdate_mFDA809716E2DB730FED2E96F6039A53756425FA6) "_MLXrBackendAnchorRelease", referenced from: _Bindings_MLXrBackendAnchorRelease_m45927BAFD08B0189A365DA93223BC921F7453104 in MLXR-ios.o _MLXRSession_Impl_GetAnchorByIdNative_mC883B51C5493073B7C6503900EB8FEC184AAD382 in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendAnchorRelease_m45927BAFD08B0189A365DA93223BC921F7453104) "_MLXrBackendAnchorGetConfidence", referenced from: _Bindings_MLXrBackendAnchorGetConfidence_mC115B43854256C41C4676ABA1346B292FB13DFF0 in MLXR-ios.o _MLXRSession_Impl_ToAnchor_m953B6BD80AEA383678113CEE0F4465F3F61BC897 in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendAnchorGetConfidence_mC115B43854256C41C4676ABA1346B292FB13DFF0) "_MLXrBackendAnchorListRelease", referenced from: _Bindings_MLXrBackendAnchorListRelease_mF4A440D1FC89E192CECD69A3A67C3CCD940D040E in MLXR-ios.o _MLXRSession_Impl_GetAllAnchorsFromNative_mF8B5941109B3EB88F0286E05074D0165317C2EDD in MLXR-ios.o (maybe you meant: Bindings_MLXrBackendAnchorListRelease_mF4A440D1FC89E192CECD69A3A67C3CCD940D040E, Bindings_MLXrBackendAnchorListReleaseAnchor_mFC7A45003A2F6B2322EB1FBF05B5BC7882DBAA2F ) "_MLXrBackendSessionUpdateToken", referenced from: _Bindings_MLXrBackendSessionUpdateToken_m296DCC572872DCDEA8DCD4F104499623B4F8666D in MLXR-ios.o _MLXRSession_Impl_SessionUpdateToken_m8E6F64C310A217ECD053D596BA411B6900CEDF98 in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendSessionUpdateToken_m296DCC572872DCDEA8DCD4F104499623B4F8666D) "_MLXrBackendAnchorListReleaseAnchor", referenced from: _Bindings_MLXrBackendAnchorListReleaseAnchor_mFC7A45003A2F6B2322EB1FBF05B5BC7882DBAA2F in MLXR-ios.o _MLXRSession_Impl_GetAllAnchorsFromNative_mF8B5941109B3EB88F0286E05074D0165317C2EDD in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendAnchorListReleaseAnchor_mFC7A45003A2F6B2322EB1FBF05B5BC7882DBAA2F) "_MLXrBackendAnchorListGetAnchor", referenced from: _Bindings_MLXrBackendAnchorListGetAnchor_m4CF70E60E4E8286DA3E309F036A1EA6FCA66500F in MLXR-ios.o _MLXRSession_Impl_GetAllAnchorsFromNative_mF8B5941109B3EB88F0286E05074D0165317C2EDD in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendAnchorListGetAnchor_m4CF70E60E4E8286DA3E309F036A1EA6FCA66500F) "_MLXrBackendSessionSetAnchorsUpdatedCallback", referenced from: _Bindings_MLXrBackendSessionSetAnchorsUpdatedCallback_m54666ABDA813E66B2B21F10A00AD7BFCDD3B9E39 in MLXR-ios.o _MLXRSession_Impl_StartSession_m4C180CB296718FBBCE2786645BE8FC913F07BFCE in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendSessionSetAnchorsUpdatedCallback_m54666ABDA813E66B2B21F10A00AD7BFCDD3B9E39) "_MLXrBackendSessionDestroy", referenced from: _Bindings_MLXrBackendSessionDestroy_m60615B1B4A078FA1DC1538AB3EEF8857FE7C9565 in MLXR-ios.o _MLXRSession_Impl_StopSession_mBF7568DF9C873D2AA00519F9FA70943D5E3ED695 in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendSessionDestroy_m60615B1B4A078FA1DC1538AB3EEF8857FE7C9565) "_MLXrBackendAnchorListGetSize", referenced from: _Bindings_MLXrBackendAnchorListGetSize_m2B65FFE04477A7EA2EF1739E967E5B064AF2F4B9 in MLXR-ios.o _MLXRSession_Impl_GetAllAnchorsFromNative_mF8B5941109B3EB88F0286E05074D0165317C2EDD in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendAnchorListGetSize_m2B65FFE04477A7EA2EF1739E967E5B064AF2F4B9) "_MLXrBackendSessionForceRelocalization", referenced from: _Bindings_MLXrBackendSessionForceRelocalization_m2F5253CA25AE18D7705CA68BA3FD457FC3757019 in MLXR-ios.o _MLXRSession_Impl_UpdateTrackingStateAndRelocalize_m130105E124778E3D1D9D9148B997E8938437F867 in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendSessionForceRelocalization_m2F5253CA25AE18D7705CA68BA3FD457FC3757019) "_MLXrBackendFrameRelease", referenced from: _Bindings_MLXrBackendFrameRelease_m196F37A69C3C79CEF4034ED05FA1EFB365BAED40 in MLXR-ios.o _MLXRSession_Impl_TryUploadImage_m56CB625D0DFDA47D5CB6FDD86765C2F08CB3C136 in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendFrameRelease_m196F37A69C3C79CEF4034ED05FA1EFB365BAED40) "_MLXrBackendAnchorGetPose", referenced from: _Bindings_MLXrBackendAnchorGetPose_mFF94CDE98975672F7C2AA870326BA320AB8BB708 in MLXR-ios.o _MLXRSession_Impl_ToAnchor_m953B6BD80AEA383678113CEE0F4465F3F61BC897 in MLXR-ios.o (maybe you meant: _Bindings_MLXrBackendAnchorGetPose_mFF94CDE98975672F7C2AA870326BA320AB8BB708) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Please enlighten me what did i miss. Thank you and hope you have a good day.

anchor ids on arkit and lumin os differ

Not sure if this is intentional. The anchor ids for the arkit build and lumin os build never match, even if they appear in the same location. I think this is causing misalignment of spawned objects.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.