Beispiel #1
0
        private void Start()
        {
            LeftHandInputDevice = new PlayerHandInputDevice(HumanBodyPart.LeftHand, settings);

            RightHandInputDevice = new PlayerHandInputDevice(HumanBodyPart.RightHand, settings);

            SubsystemManager.GetInstances(_subsystems);

            foreach (var inputSubsystem in _subsystems)
            {
                Debug.Log("Detected subsystem " + inputSubsystem.GetType());
                inputSubsystem.TrySetTrackingOriginMode(TrackingOriginModeFlags.Floor);
            }


            if (_subsystems.Count == 0)
            {
                XRDevice.SetTrackingSpaceType(TrackingSpaceType.RoomScale);
                Debug.LogWarning("No Subsystems detected");
            }

            impulse = new byte[20];

            var caps = new HapticCapabilities();

            int clipCount = (int)(caps.bufferFrequencyHz * 2);

            impulse = new byte[clipCount];

            for (int i = 0; i < clipCount; i++)
            {
                impulse[i] = byte.MaxValue;
            }
        }
Beispiel #2
0
        private void UpdateTrackingInformation(InputDevice inputDevice, PlayerHandInputDevice info)
        {
            inputDevice.TryGetFeatureValue(CommonUsages.devicePosition, out info.TrackingInformation.Position);

            inputDevice.TryGetFeatureValue(CommonUsages.deviceRotation, out info.TrackingInformation.Rotation);

            inputDevice.TryGetFeatureValue(CommonUsages.deviceAcceleration, out info.TrackingInformation.Acceleration);

            inputDevice.TryGetFeatureValue(CommonUsages.deviceVelocity, out info.TrackingInformation.Velocity);

            inputDevice.TryGetFeatureValue(CommonUsages.triggerButton,
                                           out info.InteractionInformation.IsTriggerTouched);

            inputDevice.TryGetFeatureValue(CommonUsages.trigger, out info.InteractionInformation.TriggerPressure);

            inputDevice.TryGetFeatureValue(CommonUsages.gripButton, out info.InteractionInformation.IsGripTouched);

            inputDevice.TryGetFeatureValue(CommonUsages.grip, out info.InteractionInformation.GripPressure);

            inputDevice.TryGetFeatureValue(CommonUsages.primary2DAxis,
                                           out info.InteractionInformation.JoystickPosition);

            inputDevice.TryGetFeatureValue(CommonUsages.primary2DAxisTouch,
                                           out info.InteractionInformation.IsJoystickTouched);

            inputDevice.TryGetFeatureValue(CommonUsages.primary2DAxisClick,
                                           out info.InteractionInformation.IsJoystickClicked);

            inputDevice.TryGetFeatureValue(CommonUsages.primaryButton, // A/X
                                           out info.InteractionInformation.IsPrimaryButtonClicked);

            inputDevice.TryGetFeatureValue(CommonUsages.secondaryButton, // B/Y
                                           out info.InteractionInformation.IsSecondaryButtonClicked);
        }
Beispiel #3
0
        private void UpdateTrackingInformations(PlayerHandInputDevice info)
        {
            distance += Input.mouseScrollDelta.y * .1f;

            var v3 = new Vector3(Input.mousePosition.x, Input.mousePosition.y, distance);


            info.TrackingInformation.Position = Camera.main.ScreenToWorldPoint(v3);

            info.InteractionInformation.IsPrimaryButtonClicked = Input.GetAxis("Fire1") > .8f;

            info.InteractionInformation.IsTriggerTouched = Input.GetAxis("Fire1") > 0;

            info.InteractionInformation.TriggerPressure = Input.GetAxis("Fire1");
        }
Beispiel #4
0
 private void Start()
 {
     LeftHandInputDevice  = new PlayerHandInputDevice(HumanBodyPart.LeftHand, settings);
     RightHandInputDevice = new PlayerHandInputDevice(HumanBodyPart.RightHand, settings);
 }