From 28f064c976dbcbcff4a1aedd8d9963179e4a78e7 Mon Sep 17 00:00:00 2001 From: benoitgeslain Date: Tue, 27 Feb 2024 14:39:00 +0100 Subject: [PATCH] Fix some visualisation bugs --- .../Visuo-Haptic Toolkit/Scripts/Visualisation/Socket.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Scripts/Visualisation/Socket.cs b/Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Scripts/Visualisation/Socket.cs index c3eb3861..97d708b4 100644 --- a/Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Scripts/Visualisation/Socket.cs +++ b/Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Scripts/Visualisation/Socket.cs @@ -12,7 +12,7 @@ namespace VHToolkit.Logging { [Serializable] struct WorldRedirectionData { [SerializeField] public float overTime, rotational, curvature, hybrid, total; - [SerializeField] public float time; + [SerializeField] float time; public void AddTo(float overTime, float rotational, float curvature, float hybrid, float total, float time) { this.overTime += Mathf.Abs(overTime); @@ -31,7 +31,7 @@ public class Socket : MonoBehaviour { private Razzaque2001Hybrid loggingTechnique; - private WorldRedirectionData redirectionData; + private WorldRedirectionData redirectionData = new(); private void Start() { scene = Toolkit.Instance.GetComponent().scene; @@ -51,7 +51,6 @@ private void StartSendingMessages() { } else { Thread thread = new(() => SendMessage(client, redirectionData)); thread.Start(); - redirectionData = new(); } } @@ -73,14 +72,12 @@ private void SendMessage(TcpClient client, WorldRedirectionData redirectionData) } private void Update() { - if (client != null && client.Connected) { redirectionData.AddTo(Razzaque2001OverTimeRotation.GetRedirection(scene), Razzaque2001Rotational.GetRedirection(scene), Razzaque2001Curvature.GetRedirection(scene), loggingTechnique.GetRedirection(scene), (scene.HeadToHeadRedirection.eulerAngles.y > 180f) ? 360f - scene.HeadToHeadRedirection.eulerAngles.y : scene.HeadToHeadRedirection.eulerAngles.y, (float)(DateTime.Now - startTime).TotalSeconds); - } } } }