I want to be able to use the standard Vive controller models but have the various buttons (grip, trigger, pad etc) glow or be otherwise highlighted when certain conditions arise.
I tried using the model Override on the default controller model but this is not for use in game, only in editor.
How do I replace the default controller model with, say, the vr_vive_controller_1_5 and still have it work like the normal controller with the addition of having control over the individual components?
I can’t use VRTK, just standard SteamVR.
I have searched for ages without finding any hints or even related articles, so I must be missing something!
In case anyone sees this, the answer is to follow the steps here, at least up to the throwables part.
Some notes however:
- If you want to use the SteamVR teleport, the Player object should be a child of the Camera Rig, not a separate entity in the hierarchy, otherwise once you teleport the controllers will stay where the Player component is (i.e. Player will not follow along).
- In the Player script on the Player object, you will need to set the Tracking Origin Transform to the Camera Rig.
- You need to drag “Camera (eye)” onto the “Hmd Transforms” list in Player. If you don’t, any labels created as part of the hints functionality will not face the HMD.
- I also drag Camera Rig onto the Rig 2D Fallback of Player just to stop SteamVR complaining that it doesn’t have one.
- Now, delete or de-activate the Models under the “Controller (left)” and “Controller (right)”. The BlankController that you added to the hand scripts draws a model, if the original controllers are left they are both displayed, causing z-fighting effects on the controller.
Once this is all set up you should be able to use scripts that access the controllers via the normal SteamVr_TrackedController events.
To add highlights:
- Underneath both LeftHand and RightHand objects, create three empty GameObjects and name them Attach_ControllerTip, ControllerHoverHighlight and ControllerButtonHints.
- On the left and right hand ControllerHoverHighlight GameObjects, add the component ControllerHoverHighlight.
- On the left and right hand ControllerButtonHints GameObjects, add the component ControllerButtonHints.
- Select the ControllerHoverHighlight GameObjects for each hand and add the HoverHighlight material from SteamVR/InteractionSystem/Core/Materials. Note: This can be any material, HoverHighlight is simply the standard one.
- Select the ControllerButtonHints GameObjects for each hand and add the ControllerTextHint prefab from the SteamVR/InteractionSystem/Hints/Prefabs directory
Now in your own scripts you add the “void OnHandHoverEnd(Hand hand)” method to display any hints or make buttons glow, e.g.
private void OnHandHoverBegin(Hand hand)
{
ControllerButtonHints.ShowButtonHint(hand, EVRButtonId.k_EButton_Grip);
ControllerButtonHints.ShowTextHint(hand, EVRButtonId.k_EButton_Grip, "Move thing");
}
private void OnHandHoverEnd(Hand hand)
{
ControllerButtonHints.HideButtonHint(hand, EVRButtonId.k_EButton_Grip);
ControllerButtonHints.HideTextHint(hand, EVRButtonId.k_EButton_Grip);
}
Yet another note: If you make an inspector parameter on your script so you can select the button to highlight (e.g. “public EVR_ButtonId highlighButton”), the grip and trigger selection from the dropdown get changed to something else in the list. It’s annoying, but still works. You’ll see what I mean if you try it.
I hope this helps someone, it took a lot of searching and fist banging to get to this point!
Edit:
I forgot to mention…
If you want controller button highlights to come up when in contact with your object, you need to add the Interactable script from SteamVR to it as well as all the above stuff. I.e. add your script and Interactable. Good luck…