void Start() { uOscClient = this.GetComponent <uOSC.uOscClient>(); BoneSend = this.GetComponent <SampleBonesSend>(); uOscServer = this.GetComponent <uOSC.uOscServer>(); BoneReceive = this.GetComponent <SampleBonesReceive>(); EDDPPort = this.GetComponent <Responder>(); PortText = GameObject.Find("PortText").GetComponent <Text>(); PortTextReceive = GameObject.Find("PortTextReceive").GetComponent <Text>(); inputField = GameObject.Find("InputField").GetComponent <InputField>(); inputFieldReceive = GameObject.Find("InputFieldReceive").GetComponent <InputField>(); if (PlayerPrefs.GetInt("PortNumber") != 0) { PortNumber = PlayerPrefs.GetInt("PortNumber"); PortText.text = "送信ポート番号:" + PortNumber.ToString(); inputField.text = PortNumber.ToString(); ChangePortNumber(0); } if (PlayerPrefs.GetInt("PortNumberReceive") != 0) { PortNumberReceive = PlayerPrefs.GetInt("PortNumberReceive"); PortTextReceive.text = "送信ポート番号:" + PortNumberReceive.ToString(); inputFieldReceive.text = PortNumberReceive.ToString(); ChangePortNumber(1); } }
public Send2VMCProtocolToMarionette(uOscClient client, GameObject model, SendData type) { _client = client; _model = model; switch (type) { case SendData.Body: var i = UnityEngine.Object.FindObjectsOfType <ApplyBody>(); if (i == null || !i.Select(obj => obj.isActiveAndEnabled).Contains(true)) { throw new Exception("ApplyBody is not working."); } break; case SendData.Face: var j = UnityEngine.Object.FindObjectsOfType <ApplyToVRM>(); if (j == null || !j.Select(obj => obj.isActiveAndEnabled).Contains(true)) { throw new Exception("ApplyToVRM is not working."); } break; case SendData.Both: var k = UnityEngine.Object.FindObjectsOfType <ApplyComposite>(); if (k == null || !k.Select(obj => obj.isActiveAndEnabled).Contains(true)) { throw new Exception("ApplyComposite is not working."); } break; } animator = _model.GetComponent <Animator>(); blendShapeProxy = _model.GetComponent <VRMBlendShapeProxy>(); if (animator == null) { throw new Exception("model に Animator がありません。\nThere is no Animator in the model."); } if (blendShapeProxy == null) { throw new Exception("model に VRMBlendShapeProxy がありません。\nThere is no VRMBlendShapeProxy in the model."); } }
// These methods are automatically called by Unity, you should remove any you aren't using. #region Monobehaviour Messages /// <summary> /// Only ever called once, mainly used to initialize variables. /// </summary> private void Awake() { // For this particular MonoBehaviour, we only want one instance to exist at any time, so store a reference to it in a static property // and destroy any that are created while one already exists. if (Instance != null) { Plugin.Log?.Warn($"Instance of {GetType().Name} already exists, destroying."); GameObject.DestroyImmediate(this); return; } GameObject.DontDestroyOnLoad(this); // Don't destroy this object on scene changes Instance = this; //this._device = InputDevices.GetDeviceAtXRNode(XRNode.TrackingReference); this.client = new uOscClient(); this.thread = new System.Threading.Thread(new ThreadStart(() => { while (true) { try { pose = OVRPlugin.GetNodePose(OVRPlugin.Node.Head, OVRPlugin.Step.Render).ToOVRPose(); this.client.Send(new Message("/VMC/Ext/Hmd/Pos", new object[8] { DeviceSerial, pose.position.x, pose.position.y, pose.position.z, pose.orientation.x, pose.orientation.y, pose.orientation.z, pose.orientation.w })); } catch (Exception e) { Plugin.Log.Error(e); } System.Threading.Thread.Sleep(10); } })); this.thread.Start(); Plugin.Log?.Debug($"{name}: Awake()"); }
// Use this for initialization void Start() { obj1 = GameObject.Find("Cylinders/Cylinder_0"); obj2 = GameObject.Find("Cylinders/Cylinder_1"); obj3 = GameObject.Find("Cylinders/Cylinder_2"); obj4 = GameObject.Find("Cylinders/Cylinder_3"); obj5 = GameObject.Find("Cylinders/Cylinder_4"); comp1 = obj1.GetComponent <CyliActwithPETS>(); comp2 = obj2.GetComponent <CyliActwithPETS>(); comp3 = obj3.GetComponent <CyliActwithPETS>(); comp4 = obj4.GetComponent <CyliActwithPETS>(); comp5 = obj5.GetComponent <CyliActwithPETS>(); ScoOri = GameObject.Find("ScoreCanvas/ScoreOrigin"); ScoMov = ScoOri.GetComponent <ScoreMove>(); client = GetComponent <uOscClient>(); //client.Send("/tempo", ScoMov.tempo); TrackSelect(); }
void Start() { client = GetComponent <uOscClient>(); }
public SendFace2VMCProtocolToPerformer(FaceTracking tracker, uOscClient client) { cli = client; face = tracker; }
public SendBody2VMCProtocolToPerformer(BodyTracking tracker, uOscClient client) { body = tracker; cli = client; }
void Start() { client = GetComponent <uOscClient>(); SendRoomMatrixTemporary(); //とりあえず起動時にぶん投げておく }
private void Start() { OscClient = GetComponent <uOscClient>(); var path = @"AliciaSolid.vrm"; var bytes = File.ReadAllBytes(path); Context.ParseGlb(bytes); Context.Load(); Context.ShowMeshes(); var animator = Context.Root.GetComponent <Animator>(); var HeadTracker = new GameObject("HeadTracker"); HeadTracker.transform.SetParent(animator.GetBoneTransform(HumanBodyBones.Head)); HeadTracker.transform.localPosition = Vector3.zero; VirtualTrackers.Add(HeadTracker); var LeftHandTracker = new GameObject("LeftHandTracker"); LeftHandTracker.transform.SetParent(animator.GetBoneTransform(HumanBodyBones.LeftHand)); LeftHandTracker.transform.localPosition = Vector3.zero; VirtualTrackers.Add(LeftHandTracker); var RightHandTracker = new GameObject("RightHandTracker"); RightHandTracker.transform.SetParent(animator.GetBoneTransform(HumanBodyBones.RightHand)); RightHandTracker.transform.localPosition = Vector3.zero; VirtualTrackers.Add(RightHandTracker); var LeftLowerArmTracker = new GameObject("LeftLowerArmTracker"); LeftLowerArmTracker.transform.SetParent(animator.GetBoneTransform(HumanBodyBones.LeftLowerArm)); LeftLowerArmTracker.transform.localPosition = Vector3.zero; VirtualTrackers.Add(LeftLowerArmTracker); var RightLowerArmTracker = new GameObject("RightLowerArmTracker"); RightLowerArmTracker.transform.SetParent(animator.GetBoneTransform(HumanBodyBones.RightLowerArm)); RightLowerArmTracker.transform.localPosition = Vector3.zero; VirtualTrackers.Add(RightLowerArmTracker); var SpineTracker = new GameObject("SpineTracker"); SpineTracker.transform.SetParent(animator.GetBoneTransform(HumanBodyBones.Spine)); SpineTracker.transform.localPosition = Vector3.zero; VirtualTrackers.Add(SpineTracker); var LeftLowerLegTracker = new GameObject("LeftLowerLegTracker"); LeftLowerLegTracker.transform.SetParent(animator.GetBoneTransform(HumanBodyBones.LeftLowerLeg)); LeftLowerLegTracker.transform.localPosition = Vector3.zero; VirtualTrackers.Add(LeftLowerLegTracker); var RightLowerLegTracker = new GameObject("RightLowerLegTracker"); RightLowerLegTracker.transform.SetParent(animator.GetBoneTransform(HumanBodyBones.RightLowerLeg)); RightLowerLegTracker.transform.localPosition = Vector3.zero; VirtualTrackers.Add(RightLowerLegTracker); var LeftFootTracker = new GameObject("LeftFootTracker"); LeftFootTracker.transform.SetParent(animator.GetBoneTransform(HumanBodyBones.LeftFoot)); LeftFootTracker.transform.localPosition = Vector3.zero; VirtualTrackers.Add(LeftFootTracker); var RightFootTracker = new GameObject("RightFootTracker"); RightFootTracker.transform.SetParent(animator.GetBoneTransform(HumanBodyBones.RightFoot)); RightFootTracker.transform.localPosition = Vector3.zero; VirtualTrackers.Add(RightFootTracker); }
public SendBoth2VMCProtocolToPerformer(BodyTracking BodyTracker, FaceTracking faceTracker, uOscClient client) { body = BodyTracker; face = faceTracker; cli = client; }
void Start() { client = GetComponent <uOscClient>(); server = GetComponent <uOscServer>(); switch ((int)to * 3 + (int)data) { case 0: if (!body) { Quite("Body Tracking is null!"); } sender = new SendBody2VMT(body, client); sender.SetOffsets(GetOffsets()); break; case 3: if (!body) { Quite("Body Tracking is null!"); } sender = new SendBody2VMCProtocolToPerformer(body, client); sender.SetOffsets(GetOffsets()); break; case 4: if (!face) { Quite("Face Tracking is null!"); } sender = new SendFace2VMCProtocolToPerformer(face, client); sender.SetOffsets(GetOffsets()); break; case 5: if (!face || !body) { Quite("Face Tracking or Body Tracking is null!"); } sender = new SendBoth2VMCProtocolToPerformer(body, face, client); sender.SetOffsets(GetOffsets()); break; #if VRM_EXIST case 6: if (!model) { Quite("Target model is null!"); } try { sender = new Send2VMCProtocolToMarionette(client, model, SendData.Body); }catch (Exception e) { Quite(e.Message); } break; case 7: if (!model) { Quite("Target model is null!"); } try { sender = new Send2VMCProtocolToMarionette(client, model, SendData.Face); } catch (Exception e) { Quite(e.Message); } break; case 8: if (!model) { Quite("Target model is null!"); } try { sender = new Send2VMCProtocolToMarionette(client, model, SendData.Both); } catch (Exception e) { Quite(e.Message); } break; #endif } }
public SendBody2VMT(BodyTracking tracker, uOscClient client) { body = tracker; cli = client; }