private void Awake() { rightHand = transform.Find("RightHand"); rightHand.gameObject.SetActive(false); leftHand = transform.Find("LeftHand"); leftHand.gameObject.SetActive(false); currentHand = rightHand; oldPos = Input.mousePosition; myCamera = transform.Find("Camera"); leftHand.Find("Hand").GetComponent <Renderer>().material.color = Color.red; rightHand.Find("Hand").GetComponent <Renderer>().material.color = Color.green; rightController = rightHand.GetComponent <SDK_ControllerSim>(); leftController = leftHand.GetComponent <SDK_ControllerSim>(); rightController.Selected = true; leftController.Selected = false; destroyed = false; #if VRTK_SDK_SIM Dictionary <string, KeyCode> keyMappings = new Dictionary <string, KeyCode>() { { "Trigger", triggerAlias }, { "Grip", gripAlias }, { "TouchpadPress", touchpadAlias }, { "ButtonOne", buttonOneAlias }, { "ButtonTwo", buttonTwoAlias }, { "StartMenu", startMenuAlias }, { "TouchModifier", touchModifier }, { "HairTouchModifier", hairTouchModifier } }; SDK_SimController controllerSDK = (SDK_SimController)VRTK_SDK_Bridge.GetControllerSDK(); controllerSDK.SetKeyMappings(keyMappings); #endif }
protected virtual void OnEnable() { GameObject simPlayer = SDK_InputSimulator.FindInScene(); if (simPlayer != null) { rightController = simPlayer.transform.FindChild(RIGHT_HAND_CONTROLLER_NAME).GetComponent <SDK_ControllerSim>(); leftController = simPlayer.transform.FindChild(LEFT_HAND_CONTROLLER_NAME).GetComponent <SDK_ControllerSim>(); } }
protected virtual void SetupPlayer() { if (rightController == null || leftController == null) { GameObject simPlayer = SDK_InputSimulator.FindInScene(); if (simPlayer != null) { rightController = (rightController == null ? simPlayer.transform.Find(RIGHT_HAND_CONTROLLER_NAME).GetComponent <SDK_ControllerSim>() : rightController); leftController = (leftController == null ? simPlayer.transform.Find(LEFT_HAND_CONTROLLER_NAME).GetComponent <SDK_ControllerSim>() : leftController); } } }
protected virtual void OnEnable() { hintCanvas = transform.Find("Canvas/Control Hints").gameObject; crossHairPanel = transform.Find("Canvas/CrosshairPanel").gameObject; hintText = hintCanvas.GetComponentInChildren <Text>(); hintCanvas.SetActive(showControlHints); rightHand = transform.Find("RightHand"); rightHand.gameObject.SetActive(false); leftHand = transform.Find("LeftHand"); leftHand.gameObject.SetActive(false); leftHandHorizontalAxisGuide = leftHand.Find("Guides/HorizontalPlane"); leftHandVerticalAxisGuide = leftHand.Find("Guides/VerticalPlane"); rightHandHorizontalAxisGuide = rightHand.Find("Guides/HorizontalPlane"); rightHandVerticalAxisGuide = rightHand.Find("Guides/VerticalPlane"); currentHand = rightHand; oldPos = Input.mousePosition; neck = transform.Find("Neck"); SetHandColor(leftHand, leftHandColor); SetHandColor(rightHand, rightHandColor); rightController = rightHand.GetComponent <SDK_ControllerSim>(); leftController = leftHand.GetComponent <SDK_ControllerSim>(); rightController.selected = true; leftController.selected = false; destroyed = false; SDK_SimController controllerSDK = VRTK_SDK_Bridge.GetControllerSDK() as SDK_SimController; if (controllerSDK != null) { Dictionary <string, KeyCode> keyMappings = new Dictionary <string, KeyCode>() { { "Trigger", triggerAlias }, { "Grip", gripAlias }, { "TouchpadPress", touchpadAlias }, { "ButtonOne", buttonOneAlias }, { "ButtonTwo", buttonTwoAlias }, { "StartMenu", startMenuAlias }, { "TouchModifier", touchModifier }, { "HairTouchModifier", hairTouchModifier } }; controllerSDK.SetKeyMappings(keyMappings); } rightHand.gameObject.SetActive(true); leftHand.gameObject.SetActive(true); crossHairPanel.SetActive(false); leftHand.transform.SetParent(neck); rightHand.transform.SetParent(neck); leftHandLocalPos = leftHand.localPosition; rightHandLocalPos = rightHand.localPosition; leftHand.transform.SetParent(transform); rightHand.transform.SetParent(transform); }
public SimControllers() { GameObject simPlayer = SDK_InputSimulator.FindInScene(); if (simPlayer) { rightHand = simPlayer.transform.Find(RIGHT_HAND_CONTROLLER_NAME); leftHand = simPlayer.transform.Find(LEFT_HAND_CONTROLLER_NAME); rightController = rightHand.GetComponent <SDK_ControllerSim>(); leftController = leftHand.GetComponent <SDK_ControllerSim>(); } }
public SimControllers() { GameObject simPlayer = SDK_InputSimulator.FindInScene(); if (simPlayer) { rightHand = simPlayer.transform.FindChild("RightHand"); leftHand = simPlayer.transform.FindChild("LeftHand"); rightController = rightHand.GetComponent <SDK_ControllerSim>(); leftController = leftHand.GetComponent <SDK_ControllerSim>(); } }
private void OnEnable() { hintCanvas = transform.Find("Canvas/Control Hints").gameObject; crossHairPanel = transform.Find("Canvas/CrosshairPanel").gameObject; hintText = hintCanvas.GetComponentInChildren <Text>(); hintCanvas.SetActive(showControlHints); currentHand = rightHand; oldPos = Input.mousePosition; neck = transform.Find("Neck"); baseHeight = neck.position.y; rightHand = neck.Find("RightHand"); rightHand.gameObject.SetActive(false); leftHand = neck.Find("LeftHand"); leftHand.gameObject.SetActive(false); leftHand.Find("Hand").GetComponent <Renderer>().material.color = Color.red; rightHand.Find("Hand").GetComponent <Renderer>().material.color = Color.green; rightController = rightHand.GetComponent <SDK_ControllerSim>(); leftController = leftHand.GetComponent <SDK_ControllerSim>(); rightController.Selected = true; leftController.Selected = false; destroyed = false; Cursor.visible = !hideAndLockCursor; Cursor.lockState = hideAndLockCursor ? CursorLockMode.Locked : CursorLockMode.None; var controllerSDK = VRTK_SDK_Bridge.GetControllerSDK() as SDK_SimController; if (controllerSDK != null) { Dictionary <string, KeyCode> keyMappings = new Dictionary <string, KeyCode>() { { "Trigger", triggerAlias }, { "Grip", gripAlias }, { "TouchpadPress", touchpadAlias }, { "ButtonOne", buttonOneAlias }, { "ButtonTwo", buttonTwoAlias }, { "StartMenu", startMenuAlias }, { "TouchModifier", touchModifier }, { "HairTouchModifier", hairTouchModifier } }; controllerSDK.SetKeyMappings(keyMappings); } rightHand.gameObject.SetActive(true); leftHand.gameObject.SetActive(true); crossHairPanel.SetActive(false); }
private void Awake() { rightHand = transform.FindChild("RightHand"); rightHand.gameObject.SetActive(false); leftHand = transform.FindChild("LeftHand"); leftHand.gameObject.SetActive(false); currentHand = rightHand; oldPos = Input.mousePosition; myCamera = transform.FindChild("Camera"); leftHand.FindChild("Hand").GetComponent <Renderer>().material.color = Color.red; rightHand.FindChild("Hand").GetComponent <Renderer>().material.color = Color.green; rightController = rightHand.GetComponent <SDK_ControllerSim>(); leftController = leftHand.GetComponent <SDK_ControllerSim>(); rightController.Selected = true; leftController.Selected = false; destroyed = false; }
private void Awake() { hintCanvas = transform.Find("Control Hints").gameObject; hintText = hintCanvas.GetComponentInChildren <Text>(); hintCanvas.SetActive(showControlHints); rightHand = transform.Find("RightHand"); rightHand.gameObject.SetActive(false); leftHand = transform.Find("LeftHand"); leftHand.gameObject.SetActive(false); currentHand = rightHand; oldPos = Input.mousePosition; myCamera = transform.Find("Camera"); leftHand.Find("Hand").GetComponent <Renderer>().material.color = Color.red; rightHand.Find("Hand").GetComponent <Renderer>().material.color = Color.green; rightController = rightHand.GetComponent <SDK_ControllerSim>(); leftController = leftHand.GetComponent <SDK_ControllerSim>(); rightController.Selected = true; leftController.Selected = false; destroyed = false; var controllerSDK = VRTK_SDK_Bridge.GetControllerSDK() as SDK_SimController; if (controllerSDK != null) { Dictionary <string, KeyCode> keyMappings = new Dictionary <string, KeyCode>() { { "Trigger", triggerAlias }, { "Grip", gripAlias }, { "TouchpadPress", touchpadAlias }, { "ButtonOne", buttonOneAlias }, { "ButtonTwo", buttonTwoAlias }, { "StartMenu", startMenuAlias }, { "TouchModifier", touchModifier }, { "HairTouchModifier", hairTouchModifier } }; controllerSDK.SetKeyMappings(keyMappings); } }