Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Floating objects becoming flush to other objects when in line with camera

Discussion in 'VR' started by Based01, Jul 16, 2018.

  1. Based01

    Based01

    Joined:
    Jul 16, 2018
    Posts:
    12
    Hi, I'm pretty new to Unity/Mixed Reality development and whenever I use a tap-to-place or the DirectionalIndicator (from microsoft gaze tutorials), the object that floats along with the user (e.g. the directional indicator) becomes instantly stuck to any other object that it passes.

    For instance, I have a tag-along menu and a directional indicator. Whenever the line through the camera and the indicator intersects the menu, the indicator teleports to the distance of the menu.

    How do I make the indicator not react this way? I tried to mess with physics layers but I'm not sure how to do that/ if that is the solution.

    Thank you in advance.
     
  2. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    Check if your direction indicator has a physics collider component on there. If so, remove that if it's not needed or tell your raycast script to ignore the collision with the indicator object.
     
  3. Based01

    Based01

    Joined:
    Jul 16, 2018
    Posts:
    12
    I disabled the box collider of the menu and it didn't change anything. Directional Indicator has no collider in the inspector.

    Not sure what you mean by my raycast script... I found a component on the menu called "Graphic Raycaster" but it was already set to "Everything" which included "Ignore Raycast"

    Also couldn't find any raycasting happening in the directional indicator script.

    Could you elaborate on the raycast script you mentioned?
     
  4. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    It sounded like you had some raycasting going on which shoots out from the camera and looks for game objects which are in the way, then when your tag-along movement happens that object will always stay "on top" of whatever else is in the scene. Maybe some pictures or a short video might help me visualize what you have set up.
     
  5. Based01

    Based01

    Joined:
    Jul 16, 2018
    Posts:
    12
    Jason,

    Sorry for the late reply, this problem had to be put on the back burner for a bit.

    My problem can be easily reconstructed like this:

    Create a 3d Object (cube)
    Add tap to place component
    Create another 3d Object
    Play

    Notice that when the first object is in the process of being placed (e.g. "floating around"), it will stick to the other object if you move within a certain distance of it.

    I'd like to have my directional pointer not jump away from the user unexpectedly. I'm going to look into changing which physics layer it is on. If you have quick info for this, I'd very much appreciate it :)
     
  6. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    Ooooh, it sounds like you're using the HoloToolkit from GitHub? In that case, I unfortunately can't really offer much support as to what their script is doing, our engineers do not work on that project. However, I can point you to our physics layer documentation which can be found here: https://docs.unity3d.com/Manual/LayerBasedCollision.html.
     
    Based01 likes this.
  7. Based01

    Based01

    Joined:
    Jul 16, 2018
    Posts:
    12
    Thank you!

    For anyone having this problem who comes across this: unchecking boxes in the physics collision matrix fixed it!
     
  8. Based01

    Based01

    Joined:
    Jul 16, 2018
    Posts:
    12
    Actually apparently it did not fix the problem...
     
  9. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    I would potentially present your question over at the GitHub discussion board for that project to see how their collision stuff is operating and then a solution might present itself. Apologies we can't be more help, but like I mentioned we don't work on that project so we're happy to help with specific Unity features, but we don't know much about the MRTK's implementation or issues found in their code base.