public void Initialize() { mAvatar = GetComponentInParent <IVRAvatar>(); mAvatar.InitializeExtensions(); mDevice = VRDevice.Device; mGazeInput = GetComponent <GazeInput>(); // Load controller visuals for any VRAvatarController objects attached to the avatar var avatarControllers = GetComponentsInChildren <VRAvatarController>(includeInactive: true); foreach (var controller in avatarControllers) { AttachControllerVisual(controller); } // Add event listeners mDevice.InputDeviceConnected += OnInputDeviceConnected; mDevice.InputDeviceDisconnected += OnInputDeviceDisconnected; mAvatar.Head.ActiveCameraChanged += OnActiveCameraChanged; SetupInitialControllerState(); UpdateHandedness(); }
private void Awake() { mAvatar = GetComponentInParent <IVRAvatar>(); mAvatar.InitializeExtensions(); mPrimaryControllerTracker = new GearVRTrackedControllerProxy(mAvatar, VRAvatarLimbType.RightHand); mSecondaryControllerTracker = new GearVRTrackedControllerProxy(mAvatar, VRAvatarLimbType.LeftHand); mDevice = VRDevice.Device; mSettings = gameObject.GetOrAddComponent <GearVRAvatarSettings>(); mGazeInput = GetComponent <GazeInput>(); // Setup auxiliary systems SetupManager(); SetupCameraRig(); // Activate OVRManager once everything is setup mManager.gameObject.SetActive(true); // Load controller visuals for any VRAvatarController objects attached to the avatar { var avatarControllers = GetComponentsInChildren <VRAvatarController>(includeInactive: true); foreach (var controller in avatarControllers) { AttachControllerVisual(controller); } } // Add event listeners mDevice.InputDeviceConnected += OnInputDeviceConnected; mDevice.InputDeviceDisconnected += OnInputDeviceDisconnected; mAvatar.Head.ActiveCameraChanged += OnActiveCameraChanged; SetupInitialControllerState(); UpdateHandedness(); }