void Awake() { MakeSingleton(); CurrentGameMode = GameMode.BUILD; /* Setup Controller Events */ RightControllerEvents.SubscribeToButtonAliasEvent(VRTK.VRTK_ControllerEvents.ButtonAlias.TriggerPress, true, RightControllerEvents_TriggerDown); RightControllerEvents.SubscribeToButtonAliasEvent(VRTK.VRTK_ControllerEvents.ButtonAlias.TriggerPress, false, RightControllerEvents_TriggerUp); RightControllerEvents.SubscribeToButtonAliasEvent(VRTK.VRTK_ControllerEvents.ButtonAlias.GripPress, true, RightControllerEvents_GripDown); RightControllerEvents.SubscribeToButtonAliasEvent(VRTK.VRTK_ControllerEvents.ButtonAlias.GripPress, false, RightControllerEvents_GripUp); RightControllerEvents.SubscribeToButtonAliasEvent(VRTK.VRTK_ControllerEvents.ButtonAlias.TouchpadPress, false, RightControllerEvents_TouchpadUp); LeftControllerEvents.SubscribeToButtonAliasEvent(VRTK.VRTK_ControllerEvents.ButtonAlias.TriggerPress, true, LeftControllerEvents_TriggerDown); LeftControllerEvents.SubscribeToButtonAliasEvent(VRTK.VRTK_ControllerEvents.ButtonAlias.TriggerPress, false, LeftControllerEvents_TriggerUp); LeftControllerEvents.SubscribeToButtonAliasEvent(VRTK.VRTK_ControllerEvents.ButtonAlias.GripPress, false, LeftControllerEvents_GripUp); /* Setup Controller VRTK scripts */ VRTK.VRTK_InteractGrab rightInteractGrab = RightControllerEvents.GetComponent <VRTK.VRTK_InteractGrab>(); rightInteractGrab.grabButton = VRTK.VRTK_ControllerEvents.ButtonAlias.TriggerPress; RightInteractNearTouch = RightControllerEvents.GetComponent <VRTK.VRTK_InteractNearTouch>(); RightInteractTouch = RightControllerEvents.GetComponent <VRTK.VRTK_InteractTouch>(); RightInteractGrab = RightControllerEvents.GetComponent <VRTK.VRTK_InteractGrab>(); RightAnimator = RightControllerEvents.gameObject.GetComponentInChildren <HandAnimator>(); LeftAnimator = LeftControllerEvents.gameObject.GetComponentInChildren <HandAnimator>(); }
protected override void OnEnable() { base.OnEnable(); controller.AliasPointerOn += new ControllerInteractionEventHandler(EnablePointerBeam); controller.AliasPointerOff += new ControllerInteractionEventHandler(DisablePointerBeam); controller.AliasPointerSet += new ControllerInteractionEventHandler(SetPointerDestination); controllerGrabScript = controller.GetComponent <VRTK_InteractGrab>(); var tmpMaterial = Resources.Load("WorldPointer") as Material; if (pointerMaterial != null) { tmpMaterial = pointerMaterial; } pointerMaterial = new Material(tmpMaterial); pointerMaterial.color = pointerMissColor; playAreaCursor = (GetComponent <VRTK_PlayAreaCursor>() ?? GetComponent <VRTK_PlayAreaCursor>()); if (interactWithObjects) { CreateObjectInteractor(); } }
private void AttemptSetController() { if (controller) { controller.AliasPointerOn += new ControllerInteractionEventHandler(EnablePointerBeam); controller.AliasPointerOff += new ControllerInteractionEventHandler(DisablePointerBeam); controller.AliasPointerSet += new ControllerInteractionEventHandler(SetPointerDestination); controllerGrabScript = controller.GetComponent <VRTK_InteractGrab>(); } }
private void Start() { if (controller == null) { controller = GetComponent <VRTK_ControllerEvents>(); } ConfigureEventSystem(); ConfigureWorldCanvases(); pointerClicked = false; lastPointerPressState = false; beamEnabledState = false; controllerRenderModel = (controller.GetComponent <SteamVR_RenderModel>() ? controller.GetComponent <SteamVR_RenderModel>() : controller.GetComponentInChildren <SteamVR_RenderModel>()); }
private void AttemptSetController() { if (controller) { AliasRegistration(true); controllerGrabScript = controller.GetComponent <VRTK_InteractGrab>(); if (interactWithObjects) { CreateObjectInteractor(); } } }