Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
RicoricoVR's avatar
RicoricoVR
Explorer
3 years ago

Highlighting interactable object when close to hand or controller

Hi, 

I use the SDK for developping a small app on Quest 2. I would like to "highlight", for instance by changing color, the object when the hand or the controller gets close to it (hovering on it is ok).

I found in the prefab samples "Touch Grab Examples" that the cubes use the "Material Property Block Editor" and the "Interactable Color Visual" components, but I face 2 issues:

1- the "Interactable Color Visual" asks to define colors for Normal, Hover and Select states. It works for Hovering and Select, but how can I keep the original material when we're not Hovering or Selecting ? Currently, when I reproduce the Example, my object is always looking white as defined in the "Normal" state (if change it to pink ,it would always appear pink). Even if I go to color selector and play with transparency, it remains opaque and using that color. How to avoid applying this "Normal" color to my object and only change the look when I hover or select ?

 

2- I want my app to work with either Handgrab or Controller grab. But the example of "Touch Grab Examples" only works with one single mode depending on which one ("HandGrabInteractable" or "GrabInteractable" ) I moved into the "Interactable View" parameter. How should I do ? Do I need to duplicate the "INteractble Color Visual" component and use one with "HandGrabInteractable"  and the other with  "GrabInteractable" ? (note: for my app, the approach I have is to use in my objects both "HandGrabInteractable" component and "GrabInteractable" so that it works with both hands and controller)

 

Any idea to help me ?

br,

RicoricoVR

4 Replies

Replies have been turned off for this discussion
  • Good morning RicoricoVR,
    I'm having the same problem.
    I want to keep the materials of my object but the color of NormalColorState is overlapped.
    Did you find any solution?
     
    Thanks for the help.
  • Just set the alpha value of your normal colour to 0 and also set the colour to white. Like this: -

     

  • hi , i find a solution , in the script interactable control visual you should make this code 

     public void SetNormalColor(Color newColor)
     {
         _normalColorState.Color = newColor;
     
         // Si el estado actual es "Normal", actualiza inmediatamente el color visual.
         if (InteractableView != null && InteractableView.State == InteractableState.Normal)
         {
             CancelRoutine(); // Cancela cualquier transición en curso.
             _routine = StartCoroutine(ChangeColor(_normalColorState));
         }
     } and just you need make a reference of the script in other script and call the method , that works for me , sorry if mi english not is soo good and i hope this help you