Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sample for Magic Leap integration #66

Merged
merged 20 commits into from
Mar 28, 2024
Merged

Add sample for Magic Leap integration #66

merged 20 commits into from
Mar 28, 2024

Conversation

azrogers
Copy link
Contributor

This pull request adds a sample for using Cesium with a Magic Leap 2 headset. It's a sample scene of Manhattan with locations marked for you to pick from, and you can click on each building to see its metadata. I'm filing it into a draft PR for now because there's a few bugs with the demo I still need to fix, but it's nearly there.

One thing to note is the editor scripts - I didn't want to make the whole project depend on the Magic Leap SDK, so I needed to use some editor scripting to add a script define for when the package is included. It will inform the user they need to install the SDK when opening the scene, as well as providing an option to automatically configure recommended build settings for the demo to work.

@azrogers
Copy link
Contributor Author

azrogers commented Mar 5, 2024

This sample relies on CesiumGS/cesium-unity#429 making it in.

@azrogers azrogers marked this pull request as ready for review March 12, 2024 18:30
Copy link
Contributor

@j9liu j9liu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azrogers I can't build / run the scene because I'm getting this error:

image

I commented out the code to try and run it, but then it domino'd into this:

image

I'm not sure what went wrong during setup, because I just followed the dialog boxes as they came up. Can you help with instructions so I can actually try out the level? 😄

Packages/com.cesium.unity Outdated Show resolved Hide resolved
Packages/packages-lock.json Outdated Show resolved Hide resolved
@azrogers
Copy link
Contributor Author

@azrogers I can't build / run the scene because I'm getting this error:

image

I commented out the code to try and run it, but then it domino'd into this:

image

I'm not sure what went wrong during setup, because I just followed the dialog boxes as they came up. Can you help with instructions so I can actually try out the level? 😄

I'm not sure why this is happening. Going through all the instructions on my machine gives no issues. This error should only be happening if the Magic Leap SDK is installed but for some reason the UnityEngine.XR.OpenXR.Features.MagicLeapSupport namespace is unavailable. What version of the SDK did you install? Did you install it from the tarball you got from the ML Hub?

@j9liu
Copy link
Contributor

j9liu commented Mar 22, 2024

What version of the SDK did you install? Did you install it from the tarball you got from the ML Hub?

I had version 1.8.0 installed. I retried it with 2.1.0 and the errors seem to have gone away, thankfully. But I think this means we need to document the minimum version of the SDK required.

Still, I tried to do a build and I instantly got these errors:

image

I had to go to Project Settings > XR Plugin Management > Project Validation and click "Fix All", and also manually change the Texture Compression Format to "DXT" under Project Settings > Player.

During the second build, I keep being reprompted by the window to automatically configure Build Settings for Magic Leap. But then it won't build because of these weird errors?
image

I'll keep trying to solve this on my end, but do you see these yourself @azrogers if you make a fresh clone of the samples and checkout this branch?

@azrogers
Copy link
Contributor Author

Definitely need at least version 2.0.0 of the SDK, I'll add that to the checks. Those two validation errors are tricky. The first one, DXT texture compression, isn't accessible in code before Unity 2023, and the ML SDK itself just gives up and opens the settings window for you to fix it yourself: https://github.com/magicleap/MagicLeapUnitySDK/blob/a04dcbf370525b1158e9ff1bcafddd080e4bc33a/Runtime/OpenXR/MagicLeapProjectValidation.cs#L87. The second, about the Oculus Quest Feature, is a weird one since it's detecting the feature being enabled even though it's... not. Apparently some fields in Assets/XR/Settings/OpenXR Package Settings.asset need to be updated to fix it (which I assume is what the Oculus plugin does on its own when you click "Fix"), so that's doable.

The build errors after you fixed those two issues are just because using System; was inside an #if UNITY_EDITOR block and the definition of the Case class wasn't. I've fixed that.

@j9liu
Copy link
Contributor

j9liu commented Mar 26, 2024

@azrogers I pushed a commit that does the following:

  • Implements most of my nitpick renaming / adjustment comments that I left in the review.
  • Moved CesiumFlyToController to the XR Rig, instead of the camera. The fly-to controller doesn't actually require a camera controller, so it works.
  • Flights now account for the initial rotation. The resulting flight should not spin around really fast (which was causing motion sickness for me)
  • Flight duration is now 8 seconds so that the movement is less jarring.
  • The landmark indicator was resized so it was not blocking as much of the view.

One thing I still want to test: I noticed you made changes to the VR metadata picking script, and I just want to confirm that the script still works for the Quest 2 sample. Will do tomorrow.

Let me know if there are any changes you disagree with.

@j9liu
Copy link
Contributor

j9liu commented Mar 27, 2024

Unfortunately the changes to the Metadata Picking VR script broke the metadata picking level for the Quest 2. I think the quickest solution at this point is to duplicate the script for Magic Leap, and restore the original VR script.

@azrogers
Copy link
Contributor Author

@j9liu Thank you for the changes! I've restored the old VR picking script and moved my changes into a new script just for the Magic Leap sample. I've also made changes to the README and added a Getting Started tooltip as requested!

@j9liu
Copy link
Contributor

j9liu commented Mar 27, 2024

@azrogers Thanks for the changes, I just made some minor tweaks I didn't want to trouble you with.

Unfortunately the one thing keeping me from merging is that the new CesiumSamplesMetadataPickingMagicLeap script doesn't actually work for me? Unity keeps complaining that the script is missing.

image
image

I'll try to debug tomorrow, but just running it by you in case you see this in a fresh clone of the samples.

@j9liu
Copy link
Contributor

j9liu commented Mar 28, 2024

Resolved the aforementioned script error, and fixed the incorrect controller input. Thanks @azrogers !

@j9liu j9liu merged commit ed1ac08 into main Mar 28, 2024
@j9liu j9liu deleted the magic-leap-sample branch March 28, 2024 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants