First, the basic configuration
Second, the handle UI display prompt:
Reference scenario: 029_Controller_Tooltips
Open the right handle ControllerTooltips object:
LineStart: starting point indication line
Configured as required, adjust the text, colors, starting line, and so on.
The preform can be assigned to your project.
Third, the handle vibration
private void Update()
{
//右手震动
var deviceIndex2 = SteamVR_Controller.GetDeviceIndex(SteamVR_Controller.DeviceRelation.Rightmost);
SteamVR_Controller.Input(deviceIndex2).TriggerHapticPulse(500);
}
or:
private void OnTriggerStay(Collider other)
{
VRTK_ControllerHaptics.TriggerHapticPulse(VRTK_ControllerReference.GetControllerReference(传入右手物体RightController), 0.1f);
}
Fourth, a handle integrally with the key highlighted
Direct code control.
//赋值右手,整个手柄高亮
GetComponent<VRTK_ControllerHighlighter>().HighlightController(Color.yellow);
//整个手柄取消高亮
GetComponent<VRTK_ControllerHighlighter>().UnhighlightController();
//Trigger按键高亮
GetComponent<VRTK_ControllerHighlighter>().HighlightElement(SDK_BaseController.ControllerElements.Trigger, Color.yellow);
//Trigger按键取消高亮
GetComponent<VRTK_ControllerHighlighter>().UnhighlightElement(SDK_BaseController.ControllerElements.Trigger);
Fifth, the edge of the handle with the key highlighted
Relative to the overall highlight four or five edge highlighting, different light strategy. Assignment ElementHighlighterOverriders property described below, that is, with a new outline highlighting strategies, covering the whole of the previous strategy highlighted.
1, the handle added VRTK_OutlineObjectCopyHighlighter, highlight width Thickness to 0.5.
2, if you want to handle Body highlighting the need to open the points on the object attribute VRTK_ControllerHighlighter ElementHighlighterOverriders component, VRTK_OutlineObjectCopyHighlighter component to be added to the specified Body.
3, highlighting the following code control Body:
//Trigger按键轮廓发光
GetComponent<VRTK_ControllerHighlighter>().HighlightElement(SDK_BaseController.ControllerElements.Body, Color.yellow);
GetComponent<VRTK_ControllerHighlighter>().UnhighlightElement(SDK_BaseController.ControllerElements.Body);
Six, translucent handle
//右手手柄模型半透明。0.5,透明度
VRTK_ObjectAppearance.SetOpacity(VRTK_DeviceFinder.GetModelAliasController(传入右手物体RightController), 0.5f);
//右手手柄模型恢复不透明
VRTK_ObjectAppearance.SetOpacity(VRTK_DeviceFinder.GetModelAliasController(传入右手物体RightController), 1);