The ball goes through the ground in holo lens but in unity it works well.Spatial Mapping
Asked Answered
G

2

7

enter image description here

I have built a ball that bounces around my office. In unity it bounces perfectly but when I debug the project in the holo lens 2 the ball goes through the ground, it's as if I didn't recognize the ground. What scripts should I put to recognize my office well?

In the ball I have a "Rigidbody" with IsGravity true, and in the SpatialMapping I have the "IsKinetic" true.

enter image description here

enter image description here

enter image description here

Genevivegenevra answered 28/2, 2020 at 11:56 Comment(12)
Can you make a screenshot of the Rigidbody definition of the ball?Olsson
of course! I put rigidbody screenshot.Genevivegenevra
Have you tried with different Interpolate modes as well as Collision Detection?Olsson
And one more thing, what Colliders does the two objects utilise? As I understand for ball SphereCollider is used and for the ground?Olsson
I tried with diferent Interpolate modes, I get the same result. The ball goes through the ground in holo lens but in unity it works well.Genevivegenevra
And what does Unity's documentation says about the two Colliders in question when the program is running on a device such as Holo Lens? Is their physical behaviour (collisions) well-defined?Olsson
I don't know Rixment, I put another image of set up for Spatial mapping, it has Generate colliders to true.Genevivegenevra
learn.microsoft.com/es-es/windows/mixed-reality/…Genevivegenevra
In the last link there are two scripts to spatial mapping but when i select this script in Unity a warning shows and It says that the scripts are deprecated. I dont know if exists new scripts or not. A lot of documentación is for Holo lens 1 but not for Holo lens 2.Genevivegenevra
Something that happened to me was that Hololens device was not as "fast" as I spected, and this directly affects to collision detection. Try to absurdly increase your spatial mapping colliders size, and tell me if the ball bounces. Also, which kind of collider-type are you using?Champaigne
I put and image of Spatial Mapping colliders script and spatial mapping Renderer script. How could increase my spatial mapping colliders size?Genevivegenevra
Check layers, ball and environment mesh should be on layers that can collide (see table in physics settings). Also note the warning you have about upgrading XR module.Sinegold
A
0

First, be aware that when your application launches on the HoloLens it takes a few seconds for spatial mapping to initialize and for the surface mesh to be created in Unity. If your ball is already bouncing at the very beginning of the application launch, the surface mesh may not have been constructed yet.

Also, be aware that there can be holes in the spatial mesh. HoloLens does not always see black or highly reflective objects (like mirrors). You can use the Scene Understanding library to quickly make a "water tight" mesh of the room where there will be no holes.

Good luck!

Abnormity answered 31/8, 2020 at 2:52 Comment(2)
Hope, the better way to test a solution for this question, is:Genevivegenevra
Generate a button to start the boucing ball, thereby the app will have more time to load the surface mesh. I have not been able to check the solution in the application, but it seems reasonable to solve the failure of the ball to fall through the mesh-Genevivegenevra
F
3

From the image you share, Is Kinematic (in Rigidbody class) isn't enabled but above the image you tell it's selected to true. Leave it unselected and then the object will fall naturally with gravity. You don't need to do extra changes to the Rigidbody.

Also, assuming you don't have a hole in your floor, make sure you're placing a ball bouncing around after the spatial mapping is actually completed. If you're not giving enough time to create the meshes that represent the floor, then the ball falls through it.

Fireplace answered 6/3, 2020 at 21:52 Comment(0)
A
0

First, be aware that when your application launches on the HoloLens it takes a few seconds for spatial mapping to initialize and for the surface mesh to be created in Unity. If your ball is already bouncing at the very beginning of the application launch, the surface mesh may not have been constructed yet.

Also, be aware that there can be holes in the spatial mesh. HoloLens does not always see black or highly reflective objects (like mirrors). You can use the Scene Understanding library to quickly make a "water tight" mesh of the room where there will be no holes.

Good luck!

Abnormity answered 31/8, 2020 at 2:52 Comment(2)
Hope, the better way to test a solution for this question, is:Genevivegenevra
Generate a button to start the boucing ball, thereby the app will have more time to load the surface mesh. I have not been able to check the solution in the application, but it seems reasonable to solve the failure of the ball to fall through the mesh-Genevivegenevra

© 2022 - 2024 — McMap. All rights reserved.