From ae6f9fa395544f5458afc54a20dd30fb710c4669 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Tue, 17 Dec 2024 12:11:02 +0100 Subject: [PATCH] Support Destroy --- Messages.cs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Messages.cs b/Messages.cs index 79702aa..18ddcc0 100644 --- a/Messages.cs +++ b/Messages.cs @@ -16,7 +16,7 @@ namespace Passer.Control public virtual byte Serialize(ref byte[] buffer) { return 0; } public virtual void Deserialize(byte[] buffer) { } - public bool Send(Participant client) { + public bool SendTo(Participant client) { Serialize(ref client.buffer); return client.SendBuffer(); } @@ -188,10 +188,10 @@ namespace Passer.Control this.thingId = buffer[ix++]; } - public static bool Send(Participant client, CoreThing thing) { - InvestigateMsg msg = new(thing.networkId, thing.id); - return SendMsg(client, msg); - } + //public static bool Send(Participant client, CoreThing thing) { + // InvestigateMsg msg = new(thing.networkId, thing.id); + // return SendMsg(client, msg); + //} public static async Task Receive(Stream dataStream, Participant client, byte packetSize) { if (packetSize != length) @@ -423,9 +423,13 @@ namespace Passer.Control public byte poseType; public const byte Pose_Position = 0x01; public const byte Pose_Orientation = 0x02; + public const byte Pose_LinearVelocity = 0x04; + public const byte Pose_AngularVelocity = 0x08; public Spherical position; public Quat32 orientation; + public Spherical linearVelocity; + public Spherical angularVelocity; public PoseMsg(byte networkId, byte thingId, Spherical position, Quat32 orientation) { @@ -466,8 +470,12 @@ namespace Passer.Control //if ((poseType & Pose_Position) != 0) this.position = LowLevelMessages.ReceiveSpherical(buffer, ref ix); - //if ((poseType & Pose_Orientation) != 0) { + //if ((poseType & Pose_Orientation) != 0) this.orientation = LowLevelMessages.ReceiveQuat32(buffer, ref ix); + if ((poseType & Pose_LinearVelocity) != 0) { + this.linearVelocity = LowLevelMessages.ReceiveSpherical(buffer, ref ix); + UnityEngine.Debug.Log($"Received linear velocity: {this.linearVelocity}"); + } } public static bool Send(Participant client, byte thingId, Spherical position, Quat32 orientation) @@ -576,7 +584,7 @@ namespace Passer.Control public class DestroyMsg : IMessage { public const byte Id = 0x20; - public const byte length = 2; + public const byte length = 3; public byte networkId; public byte thingId;