/// <summary>
        /// Release the instance that was previous grabbed
        /// </summary>
        private void ReleaseInstance(ref GrabbedInstanceInfo grabbedInstanceInfo)
        {
            grabbedInstanceInfo.grabbedInstance.IsGrabbed      = false;
            grabbedInstanceInfo.grabbedInstance.ExpandedBounds = CalculateExpandedBounds(grabbedInstanceInfo.grabbedInstance.Instance);

            // If object is being tracked update new calibration pose at the current location
            if (grabbedInstanceInfo.grabbedInstance.IsCalibrated)
            {
                TrackedObjectBehavior.Calibrate(grabbedInstanceInfo.grabbedInstance);
            }

            StageDressing.Logger.Info($"Released! {grabbedInstanceInfo.grabbedInstance.Instance.name}");

            grabbedInstanceInfo = null;
        }
Beispiel #2
0
        private void GameSceneLoaded()
        {
            StageDressing.Logger.Info($"GameSceneLoaded");

            TrackedDeviceManager.instance.LoadTrackedDevices();
            StageManager.instance.CreateGameInstances();

            if (this.trackedGameObjectBehavior == null)
            {
                this.trackedGameObjectBehavior = new GameObject(nameof(TrackedObjectBehavior)).AddComponent <TrackedObjectBehavior>();
            }
            this.trackedGameObjectBehavior.LoadTrackedInstances(gameScene: true);

            if (this.grabbableGameBehavior == null)
            {
                this.grabbableGameBehavior = new GameObject(nameof(GrabbableBehavior)).AddComponent <GrabbableBehavior>();
            }
            this.grabbableGameBehavior.LoadGrabbableInstances(gameScene: true);
        }
Beispiel #3
0
        private void LateMenuSceneLoadedFresh(ScenesTransitionSetupDataSO obj)
        {
            StageDressing.Logger.Info($"LateMenuSceneLoadedFresh");

            TrackedDeviceManager.instance.LoadTrackedDevices();
            StageManager.instance.LoadPrefabs();
            StageManager.instance.RebuildMenuInstances();

            if (this.trackedMenuObjectBehavior == null)
            {
                this.trackedMenuObjectBehavior = new GameObject(nameof(TrackedObjectBehavior)).AddComponent <TrackedObjectBehavior>();
            }
            this.trackedMenuObjectBehavior.LoadTrackedInstances();

            if (this.grabbableMenuBehavior == null)
            {
                this.grabbableMenuBehavior = new GameObject(nameof(GrabbableBehavior)).AddComponent <GrabbableBehavior>();
            }
            this.grabbableMenuBehavior.LoadGrabbableInstances();

            // Debug logging of existing tracked devices
            //var trackedDevices = new List<InputDevice>();
            //InputDevices.GetDevicesWithCharacteristics(InputDeviceCharacteristics.TrackedDevice, trackedDevices);
            //Logger.Info("########## Tracked Devices");
            //Logger.Info(string.Join("\r\n", trackedDevices.Select(t => $"{t.manufacturer} {t.name} {t.serialNumber} valid: {t.isValid} characteristics: {t.characteristics}")));

            //List<InputDevice> handControllers = new List<InputDevice>();
            //InputDevices.GetDevicesWithCharacteristics(InputDeviceCharacteristics.Controller, handControllers);
            //Logger.Info("########## Controller Hand Devices");
            //Logger.Info(string.Join("\r\n", handControllers.Select(t => $"{t.manufacturer} {t.name} {t.serialNumber} valid: {t.isValid} characteristics: {t.characteristics}")));

            //List<InputDevice> leftControllers = new List<InputDevice>();
            //InputDevices.GetDevicesWithCharacteristics(InputDeviceCharacteristics.Controller | InputDeviceCharacteristics.Left, leftControllers);
            //Logger.Info("########## Left Devices");
            //Logger.Info(string.Join("\r\n", leftControllers.Select(t => $"{t.manufacturer} {t.name} {t.serialNumber} valid: {t.isValid} characteristics: {t.characteristics}")));

            //List<InputDevice> rightControllers = new List<InputDevice>();
            //InputDevices.GetDevicesWithCharacteristics(InputDeviceCharacteristics.Controller | InputDeviceCharacteristics.Right, rightControllers);
            //Logger.Info("########## Right Devices");
            //Logger.Info(string.Join("\r\n", rightControllers.Select(t => $"{t.manufacturer} {t.name} {t.serialNumber} valid: {t.isValid} characteristics: {t.characteristics}")));
        }