private void Start() { cameraRaycaster = GetComponentInChildren <CameraRaycaster>().gameObject; controllerRaycaster = GetComponentInChildren <ControllerRaycaster>().gameObject; if (SDKSetup.GetHand() == null) { //Controller raycast controllerRaycaster.SetActive(true); cameraRaycaster.SetActive(false); } else { //Camera raycast cameraRaycaster.SetActive(true); controllerRaycaster.SetActive(false); } }
private void Start() { rayState = true; controller = SDKSetup.GetHand(); LineRenderer lineRenderer = controller.AddComponent <LineRenderer>(); lineRenderer.useWorldSpace = false; lineRenderer.material = new Material(Shader.Find("Sprites/Default")); lineRenderer.widthMultiplier = 0.02f; lineRenderer.positionCount = lengthOfLineRenderer; float alpha = 1.0f; Gradient gradient = new Gradient(); gradient.SetKeys( new GradientColorKey[] { new GradientColorKey(c1, 0.0f), new GradientColorKey(c2, 1.0f) }, new GradientAlphaKey[] { new GradientAlphaKey(alpha, 0.0f), new GradientAlphaKey(alpha, 1.0f) } ); lineRenderer.colorGradient = gradient; }
internal virtual void InitInputDevice(InputDevice inputDevice) { device = inputDevice; gameObject.name = device.name; if (device.role == InputDeviceRole.LeftHanded) { HandType = XR_Enum.Hand.LEFT; transform.SetParent(SDKSetup.GetHand(XR_Enum.Hand.LEFT).transform); } else if (device.role == InputDeviceRole.RightHanded) { HandType = XR_Enum.Hand.RIGHT; transform.SetParent(SDKSetup.GetHand(XR_Enum.Hand.RIGHT).transform); } transform.ResetTransform(); deviceType = SDKSetup.GetDevice(); InitKeyBindingData(); SpawnControllerModel(); }