Example #1
0
    private Player.ColorType ConvertColorType(Tracker.DeviceType deviceType)
    {
        switch (deviceType)
        {
        case (Tracker.DeviceType.GreenTracker):
            return(Player.ColorType.Green);

        //case (Tracker.DeviceType.PurpleTracker):
        //case (Tracker.DeviceType.LeftController):
        case (Tracker.DeviceType.RightController):
            return(Player.ColorType.Purple);

        case (Tracker.DeviceType.PinkTracker):
        default:
            return(Player.ColorType.Pink);
        }
    }
Example #2
0
    private void OnViveration(Tracker.DeviceType type)
    {
        if (type.ToString() == this.trackedController.name)
        {
            // 未割り当て時 int へのキャストでエラーとなる
            if (trackedController.controllerIndex > 20)
            {
                return;
            }

            var device = SteamVR_Controller.Input((int)trackedController.controllerIndex);
            if (device != null)
            {
                device.TriggerHapticPulse(1000);
            }
        }
    }