diff --git a/Runtime/HumanoidControl/Scripts/Networking/Roboid/ControlCore/LowLevelMessages.cs b/Runtime/HumanoidControl/Scripts/Networking/Roboid/ControlCore/LowLevelMessages.cs index f279dbc..43f3eeb 100644 --- a/Runtime/HumanoidControl/Scripts/Networking/Roboid/ControlCore/LowLevelMessages.cs +++ b/Runtime/HumanoidControl/Scripts/Networking/Roboid/ControlCore/LowLevelMessages.cs @@ -3,9 +3,9 @@ using Passer; public class LowLevelMessages { public static void SendSpherical(byte[] buffer, ref uint ix, Spherical v) { - SendFloat16(buffer, ref ix, new float16(v.distance)); SendAngle8(buffer, ref ix, v.horizontal); SendAngle8(buffer, ref ix, v.vertical); + SendFloat16(buffer, ref ix, new float16(v.distance)); } public static Spherical ReceiveSpherical(byte[] data, ref uint ix) { diff --git a/Runtime/HumanoidControl/Scripts/Networking/Roboid/ControlCore/Messages.cs b/Runtime/HumanoidControl/Scripts/Networking/Roboid/ControlCore/Messages.cs index b9c7e2b..f23e497 100644 --- a/Runtime/HumanoidControl/Scripts/Networking/Roboid/ControlCore/Messages.cs +++ b/Runtime/HumanoidControl/Scripts/Networking/Roboid/ControlCore/Messages.cs @@ -231,6 +231,7 @@ namespace Passer.Control { } #endregion Investigate + #region Thing public class ThingMsg : IMessage { @@ -288,13 +289,13 @@ namespace Passer.Control { public NameMsg(byte[] data) : base(data) { } public override byte[] Serialize() { - byte[] data = new byte[length + this.name.Length]; - data[0] = NameMsg.Id; - data[1] = this.thingId; - data[2] = (byte)this.name.Length; + byte[] buffer = new byte[length + this.name.Length]; + buffer[0] = NameMsg.Id; + buffer[1] = this.thingId; + buffer[2] = (byte)this.name.Length; for (int ix = 0; ix < this.name.Length; ix++) - data[3 + ix] = (byte)this.name[ix]; - return data; + buffer[3 + ix] = (byte)this.name[ix]; + return buffer; } public override void Deserialize(byte[] data) { uint ix = 0; @@ -304,7 +305,7 @@ namespace Passer.Control { } public static bool Send(Client client, byte thingId, string name) { - NameMsg msg = new NameMsg(thingId, name); + NameMsg msg = new(thingId, name); return SendMsg(client, msg); } public static async Task Receive(Stream dataStream, Client client, byte packetSize) { diff --git a/Runtime/HumanoidControl/Scripts/Networking/Roboid/HumanoidPlayerRoboid.cs b/Runtime/HumanoidControl/Scripts/Networking/Roboid/HumanoidPlayerRoboid.cs index 141418c..3cc5dc8 100644 --- a/Runtime/HumanoidControl/Scripts/Networking/Roboid/HumanoidPlayerRoboid.cs +++ b/Runtime/HumanoidControl/Scripts/Networking/Roboid/HumanoidPlayerRoboid.cs @@ -30,7 +30,8 @@ namespace Passer.Humanoid { set { _createLocalRemotes = value; } } - public int nssPort = 7681; + public int sitePort = 7681; + public string siteAddress = "127.0.0.1"; protected UdpClient udpClient; protected IPEndPoint endPoint; protected object obj; @@ -137,11 +138,12 @@ namespace Passer.Humanoid { humanoid.humanoidNetworking = this; } - endPoint = new IPEndPoint(IPAddress.Any, nssPort + 3); + endPoint = new IPEndPoint(IPAddress.Any, sitePort + 3); udpClient = new UdpClient(endPoint); receiveCallback = new System.AsyncCallback(result => ReceiveUDP(client, result)); udpClient.BeginReceive(receiveCallback, obj); - client = Client.NewUDPClient(udpClient, endPoint.Address.ToString(), endPoint.Port); + //client = Client.NewUDPClient(udpClient, endPoint.Address.ToString(), endPoint.Port); + client = Client.NewUDPClient(udpClient, siteAddress, sitePort); // //endpoint = new IPEndPoint(IPAddress.Any, sitePort);