public void OnClick(int n) { reload(); OSCRemoteButtonConfig c = GetMeta(n); switch (c.portIndex) { case 0: client9000.Send(c.address, 1); DOVirtual.DelayedCall(0.2f, () => { client9000.Send(c.address, 0); }); break; case 1: client39973.Send(c.address, c.value); break; case 2: client39974.Send(c.address, c.value); break; case 3: client39975.Send(c.address, c.value); break; default: menu.ShowDialogOK(LanguageManager.config.showdialog.PORTINDEX_INVAILD, "", 0.1f, () => {}); break; } }
private void SendPos(string worldCommand, string localCommand, Transform transform) { uClient?.Send(worldCommand, transform.name, transform.position.x, transform.position.y, transform.position.z, transform.rotation.x, transform.rotation.y, transform.rotation.z, transform.rotation.w); uClient?.Send(localCommand, transform.name, transform.localPosition.x, transform.localPosition.y, transform.localPosition.z, transform.localRotation.x, transform.localRotation.y, transform.localRotation.z, transform.localRotation.w); }
void SendVMC(string address, params object[] packet) { if (sendBundle) { bundle.Add(new Message(address, packet)); } else { uClient.Send(address, packet); } }
void Update() { var p = target.position; oscClient.Send("/Pos", p.x, p.y, p.z); if (Input.GetKeyDown(KeyCode.Space)) { oscClient.Send("/Reset", target.eulerAngles.y); } }
//低頻度(1秒以上)で送信する情報もの。ただし送信要求が来たら即時発信する public void SendPerLowRate() { //status送信が無効な場合はこれらも送信しない if (periodStatus != 0) { uOSC.Bundle infoBundle = new uOSC.Bundle(uOSC.Timestamp.Immediate); //受信有効情報(Receive enable) //有効可否と、ポート番号の送信 infoBundle.Add(new uOSC.Message("/VMC/Ext/Rcv", (int)(externalReceiver.isActiveAndEnabled ? 1 : 0), externalReceiver.receivePort)); //【イベント送信】DirectionalLight位置・色(DirectionalLight transform & color) if ((window.MainDirectionalLightTransform != null) && (window.MainDirectionalLight.color != null)) { infoBundle.Add(new uOSC.Message("/VMC/Ext/Light", "Light", window.MainDirectionalLightTransform.position.x, window.MainDirectionalLightTransform.position.y, window.MainDirectionalLightTransform.position.z, window.MainDirectionalLightTransform.rotation.x, window.MainDirectionalLightTransform.rotation.y, window.MainDirectionalLightTransform.rotation.z, window.MainDirectionalLightTransform.rotation.w, window.MainDirectionalLight.color.r, window.MainDirectionalLight.color.g, window.MainDirectionalLight.color.b, window.MainDirectionalLight.color.a)); } //【イベント送信】現在の設定 infoBundle.Add(new uOSC.Message("/VMC/Ext/Setting/Color", ControlWPFWindow.CurrentSettings.BackgroundColor.r, ControlWPFWindow.CurrentSettings.BackgroundColor.g, ControlWPFWindow.CurrentSettings.BackgroundColor.b, ControlWPFWindow.CurrentSettings.BackgroundColor.a )); infoBundle.Add(new uOSC.Message("/VMC/Ext/Setting/Win", ControlWPFWindow.CurrentSettings.IsTopMost ? 1 : 0, ControlWPFWindow.CurrentSettings.IsTransparent ? 1 : 0, ControlWPFWindow.CurrentSettings.WindowClickThrough ? 1 : 0, ControlWPFWindow.CurrentSettings.HideBorder ? 1 : 0 )); //送信 uClient?.Send(infoBundle); //【イベント送信】VRM基本情報(VRM information) [独立送信](大きいため単独で送る) if (vrmdata != null) { //ファイルパス, キャラ名 uClient?.Send(new uOSC.Message("/VMC/Ext/VRM", vrmdata.FilePath, vrmdata.Title)); } else if (string.IsNullOrEmpty(remoteName) == false) { uClient?.Send(new uOSC.Message("/VMC/Ext/Remote", remoteName, remoteJson)); } //【イベント送信】設定ファイルパス(Loaded config path) [独立送信](大きいため単独で送る) if (window != null) { //ファイルパス, キャラ名 uClient?.Send(new uOSC.Message("/VMC/Ext/Config", window.lastLoadedConfigPath)); } //【イベント送信】Option文字列(Option string) [独立送信](大きいため単独で送る) uClient?.Send(new uOSC.Message("/VMC/Ext/Opt", optionString)); } }
void Update() { uClient.Send("/VMC/Ext/Cam", "camera", transform.position.x, transform.position.y, transform.position.z, transform.rotation.x, transform.rotation.y, transform.rotation.z, transform.rotation.w, fov); }
void Update() { if (client == null) { return; } { string name = null; switch (DeviceMode) { case VirtualDevice.HMD: name = "/VMC/Ext/Hmd/Pos"; break; case VirtualDevice.Controller: name = "/VMC/Ext/Con/Pos"; break; case VirtualDevice.Tracker: name = "/VMC/Ext/Tra/Pos"; break; default: name = null; break; } if (name != null && DeviceTransform != null && DeviceSerial != null) { client.Send(name, (string)DeviceSerial, (float)DeviceTransform.position.x, (float)DeviceTransform.position.y, (float)DeviceTransform.position.z, (float)DeviceTransform.rotation.x, (float)DeviceTransform.rotation.y, (float)DeviceTransform.rotation.z, (float)DeviceTransform.rotation.w); } } { client.Send("/VMC/Ext/Blend/Val", BlendShapeName, BlendShapeValue); client.Send("/VMC/Ext/Blend/Apply"); } }
// Update is called once per frame void Update() { client.Send("/VMC/Ext/Set/Period", 1, 2, 3, 4, 5, 6); // client.Send("/VMC/Ext/Midi/CC/Val", 0, Mathf.Sin(Time.time)); // client.Send("/VMC/Ext/Blend/Val", "JOY", 1.0f); client.Send("/VMC/Ext/Blend/Apply"); /* * client.Send("/VMC/Ext/Cam", "FreeCam", * cam.position.x, cam.position.y, cam.position.z, * cam.rotation.x, cam.rotation.y, cam.rotation.z, cam.rotation.w, * (float)90f); */ client.Send("/VMC/Ext/Set/Eye", eyeEnable?1:0, eye.position.x, eye.position.y, eye.position.z); client.Send("/VMC/Ext/Hmd/Pos", "HMD", HMD.position.x, HMD.position.y, HMD.position.z, HMD.rotation.x, HMD.rotation.y, HMD.rotation.z, HMD.rotation.w); client.Send("/VMC/Ext/Con/Pos", "Con1", con1.position.x, con1.position.y, con1.position.z, con1.rotation.x, con1.rotation.y, con1.rotation.z, con1.rotation.w); client.Send("/VMC/Ext/Con/Pos", "Con2", con2.position.x, con2.position.y, con2.position.z, con2.rotation.x, con2.rotation.y, con2.rotation.z, con2.rotation.w); client.Send("/VMC/Ext/Tra/Pos", "Tra", tra.position.x, tra.position.y, tra.position.z, tra.rotation.x, tra.rotation.y, tra.rotation.z, tra.rotation.w); }
//現在の画像のパスをOSC連携アプリケーションに送信する public void send() { menu.ShowDialogOKCancel(LanguageManager.config.showdialog.OSC_APP_SEND, LanguageManager.config.showdialog.OSC_PATH_SEND + lastImagePath, 0.1f, () => { client.Send("/VaNiiMenu/ImagePathSend", lastImagePath); menu.ShowDialogOK(LanguageManager.config.showdialog.SEND_COMPLETE, lastImagePath, 0.2f, () => { }); }, () => { menu.ShowDialogOK(LanguageManager.config.showdialog.SEND_CANCEL, "", 0.2f, () => { }); }); }
//現在のテキストをOSC連携アプリケーションに送信する public void send() { menu.ShowDialogOKCancel(LanguageManager.config.showdialog.OSC_APP_SEND, LanguageManager.config.showdialog.OSC_TEXT_SEND + text.text, 0.1f, () => { client.Send("/VaNiiMenu/TextSend", text.text); menu.ShowDialogOK(LanguageManager.config.showdialog.SEND_COMPLETE, text.text, 1f, () => { }); }, () => { menu.ShowDialogOK(LanguageManager.config.showdialog.SEND_CANCEL, "", 1f, () => { }); }); }
void Update() { client.Send("/VMT/Room/Unity", index, (int)1, (float)0f, (float)transform.position.x, (float)transform.position.y, (float)transform.position.z, (float)transform.rotation.x, (float)transform.rotation.y, (float)transform.rotation.z, (float)transform.rotation.w ); }
// Update is called once per frame void Update() { textDebug.text = "ip:" + this.ip + "\n"; textDebug.text += "X:" + Frame.Pose.position.x + " \n" + "Y:" + Frame.Pose.position.y + "\n" + "Z:" + Frame.Pose.position.z + "\n" + "qX:" + Frame.Pose.rotation.x + "\n" + "qY:" + Frame.Pose.rotation.y + "\n" + "qZ:" + Frame.Pose.rotation.z + "\n" + "qW:" + Frame.Pose.rotation.w + "\n"; Vector3 pos = myPos.transform.position; pos.x = Frame.Pose.position.x - this.x; pos.y = Frame.Pose.position.y - this.y; pos.z = Frame.Pose.position.z - this.z; myPos.transform.position = pos; Quaternion qtmp = new Quaternion(Frame.Pose.rotation.x - qx, Frame.Pose.rotation.y - qy, Frame.Pose.rotation.z - qz, Frame.Pose.rotation.w - qw); myPos.transform.rotation = qtmp; textDebug.text += "X:" + myPos.transform.position.x + " \n" + "Y:" + (myPos.transform.position.y + waist) + "\n" + "Z:" + myPos.transform.position.z + "\n" + "qX:" + myPos.transform.rotation.x + "\n" + "qY:" + myPos.transform.rotation.y + "\n" + "qZ:" + myPos.transform.rotation.z + "\n" + "qW:" + myPos.transform.rotation.w + "\n" + "off_x:" + this.x + "\n" + "off_y:" + this.y + "\n" + "off_z:" + this.z + "\n"; // Debug.Log("ip:"+this.ip+"id:"+tid.ToString()+"enable:"+tenable.ToString()); client.Send("/VMT/Room/Unity", tid, tenable, timeoffset, (float)myPos.transform.position.x, (float)myPos.transform.position.y + waist, (float)myPos.transform.position.z, (float)myPos.transform.rotation.x, (float)myPos.transform.rotation.y, (float)myPos.transform.rotation.z, (float)myPos.transform.rotation.w ); }
private void Update() { var trans = transform; var position = trans.position; var rotation = trans.rotation; _client.Send("/VMT/Room/Unity", clientIndex, isEnable, 0f, position.x, position.y, position.z, rotation.x, rotation.y, rotation.z, rotation.w ); }
/// <summary> /// トラッカーを送信する /// </summary> /// <param name="index"></param> /// <param name="pos"></param> /// <param name="rot"></param> private void SendTrackerForVMT(int index, Vector3 pos, Quaternion rot) { if (uClient == null) { return; } uClient.Send("/VMT/Room/Unity", index, // 識別番号 1, // 有効可否 0f, // 補正時間 pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, rot.w ); }
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; }
void Update() { //モデルが更新されたときのみ読み込み if (Model != null && OldModel != Model) { animator = Model.GetComponent <Animator>(); blendShapeProxy = Model.GetComponent <VRMBlendShapeProxy>(); OldModel = Model; } if (Model != null && animator != null && uClient != null) { //Root var RootTransform = Model.transform; if (RootTransform != null) { uClient.Send("/VMC/Ext/Root/Pos", "root", RootTransform.position.x, RootTransform.position.y, RootTransform.position.z, RootTransform.rotation.x, RootTransform.rotation.y, RootTransform.rotation.z, RootTransform.rotation.w); } //Bones var boneBundle = new Bundle(Timestamp.Now); foreach (HumanBodyBones bone in Enum.GetValues(typeof(HumanBodyBones))) { if (bone != HumanBodyBones.LastBone) { var Transform = animator.GetBoneTransform(bone); if (Transform != null) { boneBundle.Add(new Message("/VMC/Ext/Bone/Pos", bone.ToString(), Transform.localPosition.x, Transform.localPosition.y, Transform.localPosition.z, Transform.localRotation.x, Transform.localRotation.y, Transform.localRotation.z, Transform.localRotation.w)); } } } uClient.Send(boneBundle); //ボーン位置を仮想トラッカーとして送信 var trackerBundle = new Bundle(Timestamp.Now); SendBoneTransformForTracker(ref trackerBundle, HumanBodyBones.Head, "Head"); SendBoneTransformForTracker(ref trackerBundle, HumanBodyBones.Spine, "Spine"); SendBoneTransformForTracker(ref trackerBundle, HumanBodyBones.LeftHand, "LeftHand"); SendBoneTransformForTracker(ref trackerBundle, HumanBodyBones.RightHand, "RightHand"); SendBoneTransformForTracker(ref trackerBundle, HumanBodyBones.LeftFoot, "LeftFoot"); SendBoneTransformForTracker(ref trackerBundle, HumanBodyBones.RightFoot, "RightFoot"); uClient.Send(trackerBundle); //BlendShape if (blendShapeProxy != null) { var blendShapeBundle = new Bundle(Timestamp.Now); foreach (var b in blendShapeProxy.GetValues()) { blendShapeBundle.Add(new Message("/VMC/Ext/Blend/Val", b.Key.ToString(), (float)b.Value )); } blendShapeBundle.Add(new Message("/VMC/Ext/Blend/Apply")); uClient.Send(blendShapeBundle); } //Available uClient.Send("/VMC/Ext/OK", 1); } else { uClient.Send("/VMC/Ext/OK", 0); } uClient.Send("/VMC/Ext/T", Time.time); }
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); } } }; }
// Update is called once per frame void Update() { if (CurrentModel != null && animator != null) { //Root if (vrik == null) { vrik = CurrentModel.GetComponent <VRIK>(); Debug.Log("ExternalSender: VRIK Updated"); } if (frameOfRoot > periodRoot && periodRoot != 0) { frameOfRoot = 1; if (vrik != null) { var RootTransform = vrik.references.root; var offset = handTrackerRoot.transform; if (RootTransform != null && offset != null) { uClient?.Send("/VMC/Ext/Root/Pos", "root", RootTransform.position.x, RootTransform.position.y, RootTransform.position.z, RootTransform.rotation.x, RootTransform.rotation.y, RootTransform.rotation.z, RootTransform.rotation.w, offset.localScale.x, offset.localScale.y, offset.localScale.z, offset.position.x, offset.position.y, offset.position.z); } } } frameOfRoot++; //Bones if (frameOfBone > periodBone && periodBone != 0) { frameOfBone = 1; foreach (HumanBodyBones bone in Enum.GetValues(typeof(HumanBodyBones))) { var Transform = animator.GetBoneTransform(bone); if (Transform != null) { uClient?.Send("/VMC/Ext/Bone/Pos", bone.ToString(), Transform.localPosition.x, Transform.localPosition.y, Transform.localPosition.z, Transform.localRotation.x, Transform.localRotation.y, Transform.localRotation.z, Transform.localRotation.w); } } } frameOfBone++; //Blendsharp if (blendShapeProxy == null) { blendShapeProxy = CurrentModel.GetComponent <VRMBlendShapeProxy>(); Debug.Log("ExternalSender: VRMBlendShapeProxy Updated"); } if (frameOfBlendShape > periodBlendShape && periodBlendShape != 0) { frameOfBlendShape = 1; if (blendShapeProxy != null) { foreach (var b in blendShapeProxy.GetValues()) { uClient?.Send("/VMC/Ext/Blend/Val", b.Key.ToString(), (float)b.Value ); } uClient?.Send("/VMC/Ext/Blend/Apply"); } } frameOfBlendShape++; } //Camera if (frameOfCamera > periodCamera && periodCamera != 0) { frameOfCamera = 1; if (currentCamera != null) { uClient?.Send("/VMC/Ext/Cam", "Camera", currentCamera.transform.position.x, currentCamera.transform.position.y, currentCamera.transform.position.z, currentCamera.transform.rotation.x, currentCamera.transform.rotation.y, currentCamera.transform.rotation.z, currentCamera.transform.rotation.w, currentCamera.fieldOfView); } } frameOfCamera++; //TrackerSend if (frameOfDevices > periodDevices && periodDevices != 0) { frameOfDevices = 1; uClient?.Send("/VMC/Ext/Hmd/Pos", trackerHandler.HMDObject.name, trackerHandler.HMDObject.transform.position.x, trackerHandler.HMDObject.transform.position.y, trackerHandler.HMDObject.transform.position.z, trackerHandler.HMDObject.transform.rotation.x, trackerHandler.HMDObject.transform.rotation.y, trackerHandler.HMDObject.transform.rotation.z, trackerHandler.HMDObject.transform.rotation.w); uClient?.Send("/VMC/Ext/Hmd/Pos/Local", trackerHandler.HMDObject.name, trackerHandler.HMDObject.transform.localPosition.x, trackerHandler.HMDObject.transform.localPosition.y, trackerHandler.HMDObject.transform.localPosition.z, trackerHandler.HMDObject.transform.localRotation.x, trackerHandler.HMDObject.transform.localRotation.y, trackerHandler.HMDObject.transform.localRotation.z, trackerHandler.HMDObject.transform.localRotation.w); foreach (var c in trackerHandler.Controllers) { uClient?.Send("/VMC/Ext/Con/Pos", c.name, c.transform.position.x, c.transform.position.y, c.transform.position.z, c.transform.rotation.x, c.transform.rotation.y, c.transform.rotation.z, c.transform.rotation.w); uClient?.Send("/VMC/Ext/Con/Pos/Local", c.name, c.transform.localPosition.x, c.transform.localPosition.y, c.transform.localPosition.z, c.transform.localRotation.x, c.transform.localRotation.y, c.transform.localRotation.z, c.transform.localRotation.w); } foreach (var c in trackerHandler.Trackers) { uClient?.Send("/VMC/Ext/Tra/Pos", c.name, c.transform.position.x, c.transform.position.y, c.transform.position.z, c.transform.rotation.x, c.transform.rotation.y, c.transform.rotation.z, c.transform.rotation.w); uClient?.Send("/VMC/Ext/Tra/Pos/Local", c.name, c.transform.localPosition.x, c.transform.localPosition.y, c.transform.localPosition.z, c.transform.localRotation.x, c.transform.localRotation.y, c.transform.localRotation.z, c.transform.localRotation.w); } } frameOfDevices++; //Status if (frameOfStatus > periodStatus && periodStatus != 0) { frameOfStatus = 1; if (CurrentModel != null && animator != null) { //Available uClient?.Send("/VMC/Ext/OK", 1); } else { uClient?.Send("/VMC/Ext/OK", 0); } uClient?.Send("/VMC/Ext/T", Time.time); } frameOfStatus++; //---End of frame--- }
public void ResendSetting() { setting.InitParam4trans(); //計測用HoloからユニキャストでデータをもらうとマルチキャストでHolo(観測側)に基本設定を送信し計測を始める client.Send("SettingSender", SettingManager.colormapID, SettingManager.lvMin, SettingManager.lvMax, SettingManager.objSize); }