/// <summary> Assign a VR headset to this user, which also assignes tracking parameters to both hands. </summary> /// <param name="detectedVRSet"></param> public void AssignVRSet(SG_VR_Rig detectedVRSet) { if (vrInit) { vrInit = false; //no longer need to initilaize vrRig = detectedVRSet; Debug.Log("Assgined " + detectedVRSet.name + " to the SenseGlove setup"); if (leftHand != null) { leftHand.SetTrackingHardware(vrRig.leftHandReference, vrRig.hardwareFamily); } if (rightHand != null) { rightHand.SetTrackingHardware(vrRig.rightHandReference, vrRig.hardwareFamily); } bool swappedBefore = PlayerPrefs.GetInt(swappedKey, 0) == 1; if (swappedBefore) { SwapHands(); //also calls UpdateVisuals. } else { UpdateVisuals(); } } }
void Start() { // Scan for VRRigs in case you load this User into an existing scene. if (this.vrRig == null && headsetDetection == null) { // nothing's been assigned, so let's try this.headsetDetection = GameObject.FindObjectOfType <SG_VR_Setup>(); if (headsetDetection == null) //still null { this.vrRig = GameObject.FindObjectOfType <SG_VR_Rig>(); } } }