/// <summary> /// An easy way to find the current HardlightSuit in the scene (this becomes trickier if you have multiple suits in play at once IE a networking situation) /// It will initialized the VRMimic if it is not yet initialized. /// </summary> /// <returns></returns> public static HardlightSuit Find() { HardlightSuit suit = FindObjectOfType <HardlightSuit>(); if (suit != null) { suit.Init(); return(suit); } if (VRMimic.ValidInstance()) { suit = FindObjectOfType <HardlightSuit>(); if (suit != null) { suit.Init(); return(suit); } } else { Debug.Log("Attempted to run HardlightSuit.Find() before calling VRMimic.Initialize()\nMust run VRMimic Initialize first - so you can configure hiding settings."); } return(null); }
private void InitBodyMimic(VRObjectMimic vrCamera, VRObjectMimic cameraRigMimic, int hapticLayer = NSManager.HAPTIC_LAYER) { Camera playerCameraToHideBodyFrom = vrCamera.ObjectToMimic.GetComponent <Camera>(); ActiveBodyMimic = BodyMimic.Initialize(playerCameraToHideBodyFrom, cameraRigMimic, hapticLayer); HardlightSuit.Find().SetColliderState(); }
void Awake() { //This sets up a base body. It hands in the camera so the body follows/mimics the likely movements of the user. It also hides the body from the camera (since the body is by default on layer 31) VRMimic.Initialize(targetCamera.gameObject); //Hold onto a reference to the suit. Gives us access to a variety of helper functions. suit = HardlightSuit.Find(); }
public void SetArmColliderAreaFlags() { //Set our colliders to use the correct side. Forearm.regionID = WhichArm == ArmSide.Left ? AreaFlag.Forearm_Left : AreaFlag.Forearm_Right; UpperArm.regionID = WhichArm == ArmSide.Left ? AreaFlag.Upper_Arm_Left : AreaFlag.Upper_Arm_Right; //Add the arms to the suit themselves HardlightSuit.Find().ModifyValidRegions(Forearm.regionID, Forearm.gameObject, Forearm); HardlightSuit.Find().ModifyValidRegions(UpperArm.regionID, UpperArm.gameObject, UpperArm); }