void OnRightHandMove(SocketIOEvent socketIOEvent) { string data = socketIOEvent.data.ToString(); RightHandJSON rightHandJSON = RightHandJSON.CreateFromJSON(data); Vector3 rightHandPosition = new Vector3(rightHandJSON.rightHandPosition[0], rightHandJSON.rightHandPosition[1], rightHandJSON.rightHandPosition[2]); if (rightHandJSON.name == playerNameInput.text) { return; } GameObject p = GameObject.Find(rightHandJSON.name) as GameObject; GameObject orh = p.transform.Find("Other R Hand").gameObject; if (p != null) { orh.transform.position = rightHandPosition; } }
void OnRightHandTurn(SocketIOEvent socketIOEvent) { string data = socketIOEvent.data.ToString(); RightHandJSON rightHandJSON = RightHandJSON.CreateFromJSON(data); Quaternion rightHandRotation = Quaternion.Euler(rightHandJSON.rightHandRotation[0], rightHandJSON.rightHandRotation[1], rightHandJSON.rightHandRotation[2]); if (rightHandJSON.name == playerNameInput.text) { return; } GameObject p = GameObject.Find(rightHandJSON.name) as GameObject; GameObject orh = p.transform.Find("Other R Hand").gameObject; if (p != null) { orh.transform.rotation = rightHandRotation; } }
void OnOtherPlayerRightHand(SocketIOEvent socketIOEvent) { string data = socketIOEvent.data.ToString(); RightHandJSON rightHandJSON = RightHandJSON.CreateFromJSON(data); Vector3 rightHandPosition = new Vector3(rightHandJSON.rightHandPosition[0], rightHandJSON.rightHandPosition[1], rightHandJSON.rightHandPosition[2]); Quaternion rightHandRotation = Quaternion.Euler(rightHandJSON.rightHandRotation[0], rightHandJSON.rightHandRotation[1], rightHandJSON.rightHandRotation[2]); GameObject o = GameObject.Find(rightHandJSON.name) as GameObject; if (o != null) { return; } GameObject p = GameObject.Find(rightHandJSON.name) as GameObject; GameObject OtherRightHand = p.transform.Find("Other R Hand").gameObject; GameObject orh = Instantiate(OtherRightHand, rightHandPosition, rightHandRotation) as GameObject; orh.transform.parent = p.transform; p.name = rightHandJSON.name; OtherRightHand.gameObject.SetActive(false); }