コード例 #1
0
        public void InitSetting(string micInterval, string freqMax, string freqMin, string temp, string airPressure, string span)
        {
            client = GetComponent <uOscClient>();
            if (!float.TryParse(micInterval, out interval))
            {
                interval = 0.05f;
            }
            if (!float.TryParse(freqMax, out freq_range_max))
            {
                freq_range_max = 1414f;
            }
            if (!float.TryParse(freqMin, out freq_range_min))
            {
                freq_range_min = 707f;
            }
            tempreture = float.Parse(temp);
            atm        = float.Parse(airPressure);
            if (!float.TryParse(span, out measureSpan))
            {
                measureSpan = 0.5f;
            }
            CalculateAtmDensity();

            StartCoroutine(UpdateData());
        }
コード例 #2
0
 //計測準備完了(開始ボタンに付与)
 public void InitSetting()
 {
     setting.InitParam4trans();
     client = this.gameObject.GetComponent <uOscClient>();
     client.Address();
     //計測用HoloからユニキャストでデータをもらうとマルチキャストでHolo(観測側)に基本設定を送信し計測を始める
     client.Send("SettingSender", SettingManager.colormapID, SettingManager.lvMin, SettingManager.lvMax, SettingManager.objSize);
     Debug.Log("Init setting in client");
 }
コード例 #3
0
    /// <summary>
    /// 初期化
    /// </summary>
    private void Initialize()
    {
        Screen.sleepTimeout = SleepTimeout.NeverSleep;

        uClient = GetComponent <uOSC.uOscClient>();
        laserPointer.laserBeamBehavior = LaserPointer.LaserBeamBehavior.OnWhenHitTarget;

        var ip       = DefaultValue.IP;
        var port     = DefaultValue.PORT;
        int fpsIndex = DefaultValue.FPS_INDEX;
        int adjustAbnormalPosition = DefaultValue.ADJUST_ABNORMAL_POSITION;
        int smooth  = DefaultValue.SMOOTH;
        int coverUp = DefaultValue.COVER_UP;

        if (PlayerPrefs.HasKey(PlayerPrefsKey.IP))
        {
            ip = PlayerPrefs.GetString(PlayerPrefsKey.IP);
        }
        if (PlayerPrefs.HasKey(PlayerPrefsKey.PORT))
        {
            port = PlayerPrefs.GetString(PlayerPrefsKey.PORT);
        }
        if (PlayerPrefs.HasKey(PlayerPrefsKey.FPS_INDEX))
        {
            fpsIndex = PlayerPrefs.GetInt(PlayerPrefsKey.FPS_INDEX);
        }
        if (PlayerPrefs.HasKey(PlayerPrefsKey.ADJUST_ABNORMAL_POSITION))
        {
            adjustAbnormalPosition = PlayerPrefs.GetInt(PlayerPrefsKey.ADJUST_ABNORMAL_POSITION);
        }
        if (PlayerPrefs.HasKey(PlayerPrefsKey.SMOOTH))
        {
            smooth = PlayerPrefs.GetInt(PlayerPrefsKey.SMOOTH);
        }
        if (PlayerPrefs.HasKey(PlayerPrefsKey.COVER_UP))
        {
            coverUp = PlayerPrefs.GetInt(PlayerPrefsKey.COVER_UP);
        }

        uClient.enabled = false;

        uiEvent.SetIP(ip);
        uiEvent.SetPort(port);
        uiEvent.SetFpsIndex(fpsIndex);
        uiEvent.SetAdjustAbnormalPosition(adjustAbnormalPosition);
        uiEvent.SetSmooth(smooth);
        uiEvent.SetCoverUp(coverUp);
    }
コード例 #4
0
    public void ChangeOSCAddress(string address, int port)
    {
        if (uClient == null)
        {
            uClient = GetComponent <uOSC.uOscClient>();
        }
        uClient.enabled = false;
        var type         = typeof(uOSC.uOscClient);
        var addressfield = type.GetField("address", BindingFlags.SetField | BindingFlags.NonPublic | BindingFlags.Instance);

        addressfield.SetValue(uClient, address);
        var portfield = type.GetField("port", BindingFlags.SetField | BindingFlags.NonPublic | BindingFlags.Instance);

        portfield.SetValue(uClient, port);
        uClient.enabled = true;
    }
コード例 #5
0
    void Start()
    {
        //VMT's Tracker ID
        this.tid = ChangeSCENE.tid;

        this.waist = ChangeSCENE.waist;

        //Init WaistPositionText
        WaistPosInput.text = (this.waist * 100).ToString();

        Vector3 pos = myPos.transform.position;

        pos.y = waist;
        myPos.transform.position = pos;

        //Do not Sleep
        Screen.sleepTimeout = SleepTimeout.NeverSleep;

        //OSC Send Setting
        client = GetComponent <uOSC.uOscClient>();
        client.setIp(this.ip);
    }
コード例 #6
0
 private void Start()
 {
     _client = GetComponent <uOSC.uOscClient>();
 }
コード例 #7
0
 private void Awake()
 {
     uClient           = GetComponent <uOSC.uOscClient>();
     trackingPresenter = GetComponent <TrackingPresenter>();
 }
コード例 #8
0
 void Start()
 {
     uClient = GetComponent <uOSC.uOscClient>();
 }
コード例 #9
0
    void Start()
    {
        uClient         = GetComponent <uOSC.uOscClient>();
        window          = GameObject.Find("ControlWPFWindow").GetComponent <ControlWPFWindow>();
        handTrackerRoot = GameObject.Find("HandTrackerRoot");

        trackerHandler = handTrackerRoot.GetComponent <TrackerHandler>();

        window.ModelLoadedAction += (GameObject CurrentModel) =>
        {
            if (CurrentModel != null)
            {
                this.CurrentModel = CurrentModel;
                animator          = CurrentModel.GetComponent <Animator>();
                vrik            = CurrentModel.GetComponent <VRIK>();
                blendShapeProxy = CurrentModel.GetComponent <VRMBlendShapeProxy>();
            }
        };

        window.CameraChangedAction += (Camera currentCamera) =>
        {
            this.currentCamera = currentCamera;
        };

        steamVR2Input.KeyDownEvent += (object sender, OVRKeyEventArgs e) =>
        {
            if (this.isActiveAndEnabled)
            {
                //Debug.Log("Ext: ConDown");
                try
                {
                    uClient?.Send("/VMC/Ext/Con", 1, e.Name, e.IsLeft ? 1 : 0, e.IsTouch ? 1 : 0, e.IsAxis ? 1 : 0, e.Axis.x, e.Axis.y, e.Axis.z);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
        };

        steamVR2Input.KeyUpEvent += (object sender, OVRKeyEventArgs e) =>
        {
            if (this.isActiveAndEnabled)
            {
                //Debug.Log("Ext: ConUp");
                try
                {
                    uClient?.Send("/VMC/Ext/Con", 0, e.Name, e.IsLeft ? 1 : 0, e.IsTouch ? 1 : 0, e.IsAxis ? 1 : 0, e.Axis.x, e.Axis.y, e.Axis.z);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
        };

        steamVR2Input.AxisChangedEvent += (object sender, OVRKeyEventArgs e) =>
        {
            if (this.isActiveAndEnabled)
            {
                //Debug.Log("Ext: ConAxis");
                try
                {
                    if (e.IsAxis)
                    {
                        uClient?.Send("/VMC/Ext/Con", 2, e.Name, e.IsLeft ? 1 : 0, e.IsTouch ? 1 : 0, e.IsAxis ? 1 : 0, e.Axis.x, e.Axis.y, e.Axis.z);
                    }
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
        };

        KeyboardAction.KeyDownEvent += (object sender, KeyboardEventArgs e) =>
        {
            if (this.isActiveAndEnabled)
            {
                //Debug.Log("Ext: KeyDown");
                try
                {
                    uClient?.Send("/VMC/Ext/Key", 1, e.KeyName, e.KeyCode);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
        };
        KeyboardAction.KeyUpEvent += (object sender, KeyboardEventArgs e) =>
        {
            if (this.isActiveAndEnabled)
            {
                //Debug.Log("Ext: KeyUp");
                try
                {
                    uClient?.Send("/VMC/Ext/Key", 0, e.KeyName, e.KeyCode);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
        };

        midiCCWrapper.noteOnDelegateProxy += (MidiJack.MidiChannel channel, int note, float velocity) =>
        {
            if (this.isActiveAndEnabled)
            {
                //Debug.Log("Ext: KeyDown");
                try
                {
                    uClient?.Send("/VMC/Ext/Midi/Note", 1, (int)channel, note, velocity);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
        };
        midiCCWrapper.noteOffDelegateProxy += (MidiJack.MidiChannel channel, int note) =>
        {
            if (this.isActiveAndEnabled)
            {
                //Debug.Log("Ext: KeyDown");
                try
                {
                    uClient?.Send("/VMC/Ext/Midi/Note", 0, (int)channel, note, (float)0f);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
        };
        midiCCWrapper.knobUpdateFloatDelegate += (int knobNo, float value) =>
        {
            if (this.isActiveAndEnabled)
            {
                //Debug.Log("Ext: KeyDown");
                try
                {
                    uClient?.Send("/VMC/Ext/Midi/CC/Val", knobNo, value);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
        };
        midiCCWrapper.knobUpdateBoolDelegate += (int knobNo, bool value) =>
        {
            if (this.isActiveAndEnabled)
            {
                //Debug.Log("Ext: KeyDown");
                try
                {
                    uClient?.Send("/VMC/Ext/Midi/CC/Bit", knobNo, (int)(value?1:0));
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
        };
    }
コード例 #10
0
 // Use this for initialization
 public void SendStart(string ip)
 {
     client = GetComponent <uOscClient>();
     client.OnClientStart(ip);
     StartCoroutine("SendData");
 }
コード例 #11
0
 private void Awake()
 {
     uClient = GetComponent <uOSC.uOscClient>();
 }
コード例 #12
0
    void Start()
    {
        uClient         = GetComponent <uOSC.uOscClient>();
        window          = GameObject.Find("ControlWPFWindow").GetComponent <ControlWPFWindow>();
        handTrackerRoot = GameObject.Find("HandTrackerRoot");

        trackerHandler = handTrackerRoot.GetComponent <TrackerHandler>();

        window.ModelLoadedAction += (GameObject CurrentModel) =>
        {
            if (CurrentModel != null)
            {
                this.CurrentModel = CurrentModel;
                animator          = CurrentModel.GetComponent <Animator>();
                vrik            = CurrentModel.GetComponent <VRIK>();
                blendShapeProxy = CurrentModel.GetComponent <VRMBlendShapeProxy>();
            }
        };

        window.CameraChangedAction += (Camera currentCamera) =>
        {
            this.currentCamera = currentCamera;
        };

        window.VRMmetaLodedAction += (VRMData vrmdata) =>
        {
            this.vrmdata    = vrmdata;
            this.remoteName = null;
            this.remoteJson = null;
            SendPerLowRate(); //即時送信
        };
        window.VRMRemoteLoadedAction += (string path) =>
        {
            this.vrmdata = null;
            if (path.StartsWith("dmmvrconnect://"))
            {
                var parsed = path.Substring("dmmvrconnect://".Length).Split('/');
                remoteName = "dmmvrconnect";
                remoteJson = Json.Serializer.Serialize(new DMMVRConnectRemote {
                    user_id = parsed[0], avatar_id = parsed[1]
                });
            }
            else if (path.StartsWith("vroidhub://"))
            {
                var characterModelId = path.Substring("vroidhub://".Length);
                remoteName = "vroidhub";
                remoteJson = Json.Serializer.Serialize(new VRoidHubRemote {
                    characterModelId = characterModelId
                });
            }
            SendPerLowRate(); //即時送信
        };

        window.LightChangedAction += () =>
        {
            SendPerLowRate(); //即時送信
        };

        window.LoadedConfigPathChangedAction += () =>
        {
            SendPerLowRate(); //即時送信
        };

        steamVR2Input.KeyDownEvent += (object sender, OVRKeyEventArgs e) =>
        {
            if (this.isActiveAndEnabled)
            {
                //Debug.Log("Ext: ConDown");
                try
                {
                    uClient?.Send("/VMC/Ext/Con", 1, e.Name, e.IsLeft ? 1 : 0, e.IsTouch ? 1 : 0, e.IsAxis ? 1 : 0, e.Axis.x, e.Axis.y, e.Axis.z);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
        };

        steamVR2Input.KeyUpEvent += (object sender, OVRKeyEventArgs e) =>
        {
            if (this.isActiveAndEnabled)
            {
                //Debug.Log("Ext: ConUp");
                try
                {
                    uClient?.Send("/VMC/Ext/Con", 0, e.Name, e.IsLeft ? 1 : 0, e.IsTouch ? 1 : 0, e.IsAxis ? 1 : 0, e.Axis.x, e.Axis.y, e.Axis.z);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
        };

        steamVR2Input.AxisChangedEvent += (object sender, OVRKeyEventArgs e) =>
        {
            if (this.isActiveAndEnabled)
            {
                //Debug.Log("Ext: ConAxis");
                try
                {
                    if (e.IsAxis)
                    {
                        uClient?.Send("/VMC/Ext/Con", 2, e.Name, e.IsLeft ? 1 : 0, e.IsTouch ? 1 : 0, e.IsAxis ? 1 : 0, e.Axis.x, e.Axis.y, e.Axis.z);
                    }
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
        };

        KeyboardAction.KeyDownEvent += (object sender, KeyboardEventArgs e) =>
        {
            if (this.isActiveAndEnabled)
            {
                //Debug.Log("Ext: KeyDown");
                try
                {
                    uClient?.Send("/VMC/Ext/Key", 1, e.KeyName, e.KeyCode);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
        };
        KeyboardAction.KeyUpEvent += (object sender, KeyboardEventArgs e) =>
        {
            if (this.isActiveAndEnabled)
            {
                //Debug.Log("Ext: KeyUp");
                try
                {
                    uClient?.Send("/VMC/Ext/Key", 0, e.KeyName, e.KeyCode);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
        };

        midiCCWrapper.noteOnDelegateProxy += (MidiJack.MidiChannel channel, int note, float velocity) =>
        {
            if (this.isActiveAndEnabled)
            {
                //Debug.Log("Ext: KeyDown");
                try
                {
                    uClient?.Send("/VMC/Ext/Midi/Note", 1, (int)channel, note, velocity);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
        };
        midiCCWrapper.noteOffDelegateProxy += (MidiJack.MidiChannel channel, int note) =>
        {
            if (this.isActiveAndEnabled)
            {
                //Debug.Log("Ext: KeyDown");
                try
                {
                    uClient?.Send("/VMC/Ext/Midi/Note", 0, (int)channel, note, (float)0f);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
        };
        midiCCWrapper.knobUpdateFloatDelegate += (int knobNo, float value) =>
        {
            if (this.isActiveAndEnabled)
            {
                //Debug.Log("Ext: KeyDown");
                try
                {
                    uClient?.Send("/VMC/Ext/Midi/CC/Val", knobNo, value);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
        };
        midiCCWrapper.knobUpdateBoolDelegate += (int knobNo, bool value) =>
        {
            if (this.isActiveAndEnabled)
            {
                //Debug.Log("Ext: KeyDown");
                try
                {
                    uClient?.Send("/VMC/Ext/Midi/CC/Bit", knobNo, (int)(value?1:0));
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
        };

        this.gameObject.SetActive(false);
        uClient.enabled = true;
    }
コード例 #13
0
 //トリガーで座標送信する
 // Use this for initialization
 void Start()
 {
     client = GetComponent <uOscClient>();
     //  StartCoroutine("SendData");
 }