示例#1
0
 // Register input sources for hands based on hand data
 protected void UpdateHandDevice(HandSimulationMode simulationMode, Handedness handedness, SimulatedHandData handData)
 {
     if (handData != null && handData.IsTracked)
     {
         SimulatedHand controller = GetOrAddHandDevice(handedness, simulationMode);
         controller.UpdateState(handData);
     }
     else
     {
         RemoveHandDevice(handedness);
     }
 }
        // Register input sources for controllers based on controller data
        protected void UpdateControllerDevice(ControllerSimulationMode simulationMode, Handedness handedness, object controllerData)
        {
            if (controllerData != null)
            {
                if (controllerData is SimulatedHandData handData && handData.IsTracked)
                {
                    SimulatedHand hand = GetOrAddControllerDevice(handedness, simulationMode) as SimulatedHand;
                    hand.UpdateState(handData);
                    return;
                }
            }

            RemoveControllerDevice(handedness);
        }
        // Register input sources for hands based on changes of the data provider
        private void UpdateHandInputSource(Handedness handedness, SimulatedHandData handData)
        {
            var profile = InputSimulationProfile;

            if (profile.HandSimulationMode == HandSimulationMode.Disabled)
            {
                RemoveAllHandDevices();
            }
            else
            {
                if (handData != null && handData.IsTracked)
                {
                    SimulatedHand controller = GetOrAddHandDevice(handedness, profile.HandSimulationMode);
                    controller.UpdateState(handData);
                }
                else
                {
                    RemoveHandDevice(handedness);
                }
            }
        }