diff --git a/impulse/Assets/Scripts/Player/PlayerController.cs b/impulse/Assets/Scripts/Player/PlayerController.cs index 265150f34a54ef580255627940308660ce845492..23878f5cf7a857cbafa5edfa0a5785043a4c2d33 100644 --- a/impulse/Assets/Scripts/Player/PlayerController.cs +++ b/impulse/Assets/Scripts/Player/PlayerController.cs @@ -140,25 +140,25 @@ public class PlayerController : MonoBehaviour float[] newPosition = pm.updatePosition(playerUdpClient?.data); float x = newPosition[0]; - float y = newPosition[2]; float z = newPosition[1]; + float y = newPosition[2]; // because it's sending only x,y coords and in Unity on flat the coords are x,z float theta_x = newPosition[3]; float theta_y = newPosition[4] * rotationSensibility; float theta_z = newPosition[5]; StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.AppendLine($"PositionManager : [x {x}], [y {y}], [z {z}] - [theta_x {theta_x}], [theta_y {theta_y}], [theta_z {theta_z}]"); - stringBuilder.AppendLine($"Transform P : [x {this.transform.position.x}], [y {this.transform.position.y}], [z {this.transform.position.z}]"); + //stringBuilder.AppendLine($"PositionManager : [x {x}], [y {y}], [z {z}] - [theta_x {theta_x}], [theta_y {theta_y}], [theta_z {theta_z}]"); + stringBuilder.AppendLine($"\nTransform P : \t\t[x {this.transform.position.x}], [y {this.transform.position.y}], [z {this.transform.position.z}]"); Vector3 movement = new Vector3(x, 0, z); this.transform.position += movement * Time.deltaTime * movementSensibility; - stringBuilder.AppendLine($"Updated Transform P : [x {this.transform.position.x}], [y {this.transform.position.y}], [z {this.transform.position.z}]"); - stringBuilder.AppendLine($"Transform R : [x {this.transform.rotation.x}], [y {this.transform.rotation.y}], [z {this.transform.rotation.z}]"); + stringBuilder.AppendLine($"Updated Transform P : \t[x {this.transform.position.x}], [y {this.transform.position.y}], [z {this.transform.position.z}]"); + //stringBuilder.AppendLine($"Transform R : [x {this.transform.rotation.x}], [y {this.transform.rotation.y}], [z {this.transform.rotation.z}]"); Quaternion newRotation = Quaternion.Euler(theta_x, theta_y, theta_z); this.transform.rotation = newRotation; - stringBuilder.AppendLine($"Updated Transform R : [x {this.transform.rotation.x} ], [y {this.transform.rotation.y} ], [z {this.transform.rotation.z}]"); + //stringBuilder.AppendLine($"Updated Transform R : [x {this.transform.rotation.x} ], [y {this.transform.rotation.y} ], [z {this.transform.rotation.z}]"); print(stringBuilder.ToString()); } diff --git a/impulse/Assets/Scripts/Player/PositionManager.cs b/impulse/Assets/Scripts/Player/PositionManager.cs index fd7cacc4732bc7dd3e299350ee36e97fe72f8b27..87fea5fb4061a08782be59eae215cd5d6e2e0eaa 100644 --- a/impulse/Assets/Scripts/Player/PositionManager.cs +++ b/impulse/Assets/Scripts/Player/PositionManager.cs @@ -74,16 +74,16 @@ public class PositionManager : MonoBehaviour { // Split the message by comma string[] values = data.Split(','); - string a = ""; - for (int i = 0; i < values.Length; i++) { - a += $"[{i}] {values[i]}"; - } - print(a); + //string a = ""; + //for (int i = 0; i < values.Length; i++) { + // a += $"[{i}] {values[i]}"; + //} + //print(a); // Create the coordinates list with the first 3 values coordinates[0] = float.Parse(values[0]); - coordinates[2] = float.Parse(values[1]); - coordinates[1] = float.Parse(values[2]); + coordinates[1] = float.Parse(values[1]); + coordinates[2] = float.Parse(values[2]); // Create the angles list with the last 3 values angles[0] = float.Parse(values[3]); diff --git a/impulse/UDP_App/UDPsender.py b/impulse/UDP_App/UDPsender.py index bf984496eb192c49a164968acb613ec19e0f025f..729c4291f44e51d5b765e3e0622e85ec4ed140fa 100644 --- a/impulse/UDP_App/UDPsender.py +++ b/impulse/UDP_App/UDPsender.py @@ -35,7 +35,7 @@ def update_position(): z = 0 - data = aggregate_values_to_string(x, y, z, x_theta, y_theta, z_theta) + data = aggregate_values_to_string(x, -y, z, x_theta, y_theta, z_theta) sock.sendto(data.encode(), (UDP_IP, UDP_PORT)) print("Sent:", data)