Search Unity

Resolved Material Glitches with Interactable Script (Steam VR 2.0)

Discussion in 'VR' started by Max-jacob, Dec 9, 2021.

  1. Max-jacob

    Max-jacob

    Joined:
    May 4, 2021
    Posts:
    5
    Hi guys,
    i'm relatively new so maybe i just missed some setting,
    but i have the following problem:

    I'm working on a VR-scenario for reanimation and want
    to make some surfaces interactable.

    The window handle for example:
    It has a circular drive first turn the handle
    and then turn (open) the window with another circular drive.

    The Body just has an interactable script, so the VR hand can't
    penetrate the mesh.

    I tried everything, exactly followed this tutorial (for the circular drives),
    i just have no idea, why my materials glitch so hard.

    Interactable Script.PNG
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,059
    This is called Z-fighting and happens when 2 objects/planes are at exactly the right position. I don't really know what causes this in SteamVR, but have seen the same for others
    I personally moved away from SteamVR (either use XR Interaction Toolkit for free or paid VR Interaction Framework) because of issues it had, and OpenXR does the same for me while being easily integrated on all platforms at once
     
  3. Max-jacob

    Max-jacob

    Joined:
    May 4, 2021
    Posts:
    5
    Thanks for the quick answer, however i'm somewhat confident, that this isn't the case. The window, for example, is just one object, it has no collider, no second plane, nothing. Same with the handle (which glitches as well). And it only appears, when touched by the AR-Hand. shouldn't Z-fighting also appear, when i don't touch the object?
     
  4. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,059
    I think SteamVR makes a copy of the object in the hand or something like that. You could try:

    - grab object with z fighting
    - pause unity while holding it
    - drag away the handle and see if there is anything underneath (or if there is a new mesh renderer on the object maybe)
    - drag the hand away from the object to see if the object is in the hand
     
  5. Max-jacob

    Max-jacob

    Joined:
    May 4, 2021
    Posts:
    5
    i jut found the issue!
    "highlight on Hover! this box was checked.

    It seams, the highlight just uses the mesh, which is displayed at
    the exact same coordinates and dimensions.

    I unckecked the box and now it works :)
     
    DevDunk likes this.
  6. Max-jacob

    Max-jacob

    Joined:
    May 4, 2021
    Posts:
    5
    (You can propably adjust the position and scale of the highlight, i didn't look for it because i don't need it)
     
  7. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,059
    Sweet! Thanks for the solution!