示例#1
0
        protected SubTracker NewLighthouse(HumanoidControl humanoid, uint sensorId)
        {
            SubTracker subTracker = SteamVRSubTracker.Create(this);

            subTracker.subTrackerId = (int)sensorId;
            return(subTracker);
        }
示例#2
0
        protected virtual void OnNewSensor(uint sensorId)
        {
            Passer.ETrackedDeviceClass deviceClass = Passer.OpenVR.System.GetTrackedDeviceClass(sensorId);
            switch (deviceClass)
            {
            case Passer.ETrackedDeviceClass.HMD:
                hmd = FindHmd(sensorId);
                if (hmd == null)
                {
                    hmd = SteamVrHmdComponent.NewHmd(humanoid, (int)sensorId);
                }
                break;

            case Passer.ETrackedDeviceClass.TrackingReference:
                SubTracker subTracker = FindLighthouse(sensorId);
                if (subTracker == null)
                {
                    subTracker = NewLighthouse(humanoid, sensorId);
                    subTrackers.Add(subTracker);
                }
                break;

            case Passer.ETrackedDeviceClass.Controller:
                SteamVrControllerComponent controller = FindController(sensorId);
                if (controller == null)
                {
                    controller = SteamVrControllerComponent.NewController(humanoid, (int)sensorId);
                    controllers.Add(controller);
                }
                break;

#if hVIVETRACKER
            case Passer.ETrackedDeviceClass.GenericTracker:
                ViveTrackerComponent viveTracker = FindViveTracker(sensorId);
                if (viveTracker == null)
                {
                    viveTracker = ViveTracker.NewViveTracker(humanoid, sensorId);
                    viveTrackers.Add(viveTracker);
                }
                break;
#endif
            default:
                break;
            }
        }