Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Hiding/showing the Ray when interacting with a Grab Interactable

Discussion in 'XR Interaction Toolkit and Input' started by gavinprior, Jan 19, 2023.

  1. gavinprior

    gavinprior

    Joined:
    Jul 27, 2020
    Posts:
    42
    Hello all.
    I am having fun with this one. It's pretty simple in terms of what I want to do but can't figure it out(!):

    I am picking up a grabable object via the Ray Interactor which works fine. What I want to do is hide the ray while I am holding the object. Then show the ray again when I drop it. Current standard functionality leaves the ray visible.

    I have the Ray Interactor as 'Sticky' so i'm not having to hold the grip button down and this is fine.

    'Hide Controller On Select' doesn't hide the ray (obviously).

    I've tried interactor events - just hiding the ray but it doesn't work properly as then how do you show the ray again when you drop the object..

    Any ideas?
     
  2. ukUnityVrUser

    ukUnityVrUser

    Joined:
    Dec 10, 2015
    Posts:
    11
    Did you manage to find a solution to this?
     
  3. ericprovencher

    ericprovencher

    Unity Technologies

    Joined:
    Dec 17, 2020
    Posts:
    146
    One to try could be to mess with the gradient colors of the line visual component associated with the ray interactor.

    That said options are limited in 2.3.1 for this. You could implement a custom line renderable component or extend the current line visual to achieve this.

    We’ll try and make this easier in future versions.
     
    gavinprior likes this.
  4. gavinprior

    gavinprior

    Joined:
    Jul 27, 2020
    Posts:
    42
    Sort of. More of a fudge than a fix. It worked by moving the z value of the Attach transform object almost to the edge. That way the object sort of blocks the ray from extending out.

    You can see the effect here from around 23 seconds as I grab the brick/key object: