Search code examples
unity-game-enginehololenshololens-emulator

Microsoft HoloLens Tutorial, cursor on own object


I'm starting to develop for the Microsoft HoloLens. For that, I made the Tutorials from the Hololens Academy. This worked fine.

Now I want to use a simple 3D Sphere instead the astroman and add the cursor from the academy source code. My problem is that the cursor is not visible while its on the sphere. Sometimes I can see the cursor at the border of the sphere.

If the cursor is not pointing on the sphere, its visible. Like in the tutorial its a star then.

Steps to Reproduce: Follow the tutorial Holograms 210 Chapter One. In step "Setup the scene" Don't add AstroMan, SpaceAudioSource and SpaceBackground. In hierarchy click Create --> 3D Object --> Sphere. Then place the sphere in front of the camera X: 0, Y0, Z3. And scale it to X=Y=Z=0.2. Then follow the tutorial chapter 1 to the end.

What do I wrong? I tried to add Material, select the Trigger checkbox... It's not working.

Thanks a lot for every kind of help.

Cursor not centered on sphere:

Cursor not centered on sphere

Cursor centered on sphere:

Cursor centered on sphere

SOLUTION

Thanks to the answer from @Cameron Vetter I found my mistake.

My collider was exactly the same size like the mesh render. So the cursor and the mesh where exactly on the same height. Thats why I could not see the cursor on the object.

I removed the standard collider and added a box collider. Then I scaled this box collider a bit greater than the mesh (1.05) each axis. Now it works!


Solution

  • The cursor uses the unity collider to determine if it hits an object by raycasting from the viewer's perspective out and seeing if it hits any colliders. My guess is that you did not add a collider to your sphere.

    In unity select your sphere in the hierarchy and click add component in the inspector. Add a Mesh Collider and everything should just work.

    In real world use cases you would want to use a sphere collider instead of a mesh collider. They are less processor intensive but will require you to setup the center and radius properly.