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

SpatialUnderstanding HoloToolkit module - first time checkin #187

Merged
merged 6 commits into from Aug 30, 2016

Conversation

jevertt
Copy link

@jevertt jevertt commented Aug 25, 2016

This module builds on top of the spatial mapping component, analyzing the environment and supporting queries like - what is floor, ceiling, and much more. This module exposes the analysis techniques used in Conker and Fragments.

This module builds on top of the spatial mapping component, analyzing
the environment and supporting queries like - what is floor, ceiling,
and much more. This module exposes the analysis techniques used in
Conker and Fragments.
public Cursor AppCursor;

// Properties
public string SpaceQueryDescription
Copy link

Choose a reason for hiding this comment

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

NIT: I wonder if you can get away with public string SpaceQueryDescription { get; set; }
Unless you really need objectPlacementDescription = "";

@jwittner
Copy link
Member

Just played around a bunch with this - tool cool! My whole team is very excited to have this!

@JeffPack
Copy link

This is amazing! Thank you!

I am trying to save the UnderstandingCustomMesh to a file and reload it during the game in order to use for collision so I don't have to rescan every time the game is played. I do this after finalization.

It works like a charm... kind of. Problem is, even after waiting for ScanStates.Done, when I pull the mesh filters to save the meshes, it is not the finalized, closed mesh.

I am certain that all meshes being pulled by:

roomMeshFilters = SpatialUnderstanding.Instance.UnderstandingCustomMesh.GetMeshFilters() as List<MeshFilter>;

are being saved. Any thoughts on how I can pull the entire, finalized, closed mesh from UnderstandingCustomMesh?

@JeffPack
Copy link

I figured out the problem. I was assuming that when the scan state is done, then mesh finalization was complete. I then realized that at this is set at the end of SpatialUnderstanding.Update_Scan() and is set immediately after the start of the final import coroutine. Rather than having it depend on the state, I simply retrieved the mesh upon exiting the room scan and it works beautifully. Right now my class only supports saving one room but it can easily be expanded. Thanks again for a great tool!

@jbienzms
Copy link
Contributor

This may not have been due to these changes, but the first time I tried importing this branch into a Unity project I got 14 errors that all said the same thing:

You are trying to import an asset which contains a global game manager. This is not allowed.

Again, it may not be due to this branch but I wanted to at least report it and see if anyone else experienced the same thing. I cleared the error messages, closed the project and opened it again and I haven't seen any errors since. But I also tried to look up that error and didn't find anything helpful.

@jbienzms
Copy link
Contributor

Also, looking at the inspector in your demo scene (Main) the camera is missing two scripts.

The first missing script is right after Gaze Manager and it has three inspector properties:

  1. First Selected
  2. Send Navigation Events
  3. Drag Threshold

The second missing script does not have any inspector properties, but it's the last one in the behavior list for Main Camera.

@jbienzms
Copy link
Contributor

@JeffPack can you share the code you're using for saving the entire SpatialUnderstanding mesh? And can you explain a bit more about when you're triggering the save? I would like to use the scan of my living room in the Unity editor at design time. Thanks man!

## SETUP
1. Import the HoloToolkit into the project
2. Open the Scenes\Main level
3. Build for HoloLens
Copy link
Contributor

Choose a reason for hiding this comment

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

I know "Build for HoloLens" step should technically cover this, but you might want to add "Don't forget to turn on the SpatialPerception capability under Player settings." I created a new Unity project, used the HoloToolkit menu item to apply project settings, then imported your scene. When I first ran it on the device it took a minute or two before dawned on me why it wouldn't progress beyond the "Scan your play space" message. Doh!

@jbienzms
Copy link
Contributor

Oh, and I just wanted to say that this is going to be phenomenally helpful for everyone. Thank you so much for taking the time to contribute this @jevertt!

@thebanjomatic
Copy link

I played around with this a little the last couple of days. I noticed some strange behavior with the mapping process. In the first case, the mesh would start to disappear creating holes in the areas I was looking at instead of refining, particularly the longer I looked around.

The second problem I noticed was that I encountered a state where no matter how much I looked at a particular region that should have been easy to map, it just wasn't showing up. In the end, I was left with a hole about 2m on each side, so I'm guessing that its possible one of the source mesh objects somehow got skipped/dropped from the list of mesh inputs to the playspace generation.

Ignore the messy room, but here's a screenshot I captured of the bug in action:
image

@jbienzms
Copy link
Contributor

I've experienced the same thing as @thebanjomatic. I also noticed that if I walked too far away from the place where I first started scanning, when I returned to that place later it wouldn't resume scanning in that area. The whole area was just blank and no matter how much looking around I did it would never resume again in that area.

@jbienzms
Copy link
Contributor

Wow @JeffPack! Thank you so much for sharing all of that in detail!

I think we should be sensitive to this thread though, since it's dedicated to the actual pull request we're all excited about. I'm thinking there's probably a better place to post all that info than directly inline here.

What I'm going to do is open up a new "Issue" and ask for help saving the mesh. Would you be so kind as to remove that content above and post it in response to my issue? Then we can mark the issue resolved.

Here's a link to the issue: #188

public class SpatialUnderstanding : Singleton<SpatialUnderstanding>
{
// Consts
public const float ScanSearchDistance = 8.0f;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since SpatialUnderstanding.cs is not sample code and is part of the actual toolkit, shouldn't ScanSearchDistance be an inspector variable instead of a constant?

…emoved \ProjectSettings

Keeping it consistent with the other examples, per Neeraj's request
@NeerajW
Copy link

NeerajW commented Aug 30, 2016

Merging this code now so everyone can benefit from 'master'.
For any other non-blocking troubles, please file issues or feel free to fix and launch a PR.
Thank you for the contributions!

@NeerajW NeerajW merged commit 8d39c9b into microsoft:master Aug 30, 2016
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.

None yet

9 participants