1
0
mirror of https://github.com/CLfamilaris/VRDOM.git synced 2024-11-24 03:00:09 +01:00

Reset global rotation on raycasts + fix decimal seperator stuff

This commit is contained in:
RubberDuckShobe 2023-08-22 17:10:48 +02:00
parent 8e4b05ac4d
commit 0eb387a62f
2 changed files with 5 additions and 3 deletions

View File

@ -1,5 +1,6 @@
using Godot; using Godot;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Text; using System.Text;
using VRDOM; using VRDOM;
@ -10,6 +11,7 @@ public partial class GameConnection : Node
[Export] [Export]
private FootSensor _footSensor; private FootSensor _footSensor;
private CultureInfo formatLocale = new("en-US");
private WebSocketPeer _wsPeer = new(); private WebSocketPeer _wsPeer = new();
readonly double lightingGetInterval = 0.0166; readonly double lightingGetInterval = 0.0166;
double lightingGetTimer = 0; double lightingGetTimer = 0;
@ -30,11 +32,11 @@ public partial class GameConnection : Node
string touchCommandString = "{\"id\":1,\"module\":\"drs\",\"function\":\"touch_set\",\"params\":["; string touchCommandString = "{\"id\":1,\"module\":\"drs\",\"function\":\"touch_set\",\"params\":[";
foreach (var touchCommand in touchCommands) foreach (var touchCommand in touchCommands)
{ {
touchCommandString += "[" + touchCommand.touchEvent + "," + touchCommand.sensorId + "," + touchCommand.touchPosition.X.ToString("0.0000") + "," + touchCommand.touchPosition.Y.ToString("0.0000") + "," + touchCommand.touchSize.X + "," + touchCommand.touchSize.Y + "],"; // honestly what did i smoke when i wrote this, i should REALLY go back and change this?? maybe?
touchCommandString += "[" + touchCommand.touchEvent + "," + touchCommand.sensorId + "," + touchCommand.touchPosition.X.ToString("0.0000", formatLocale) + "," + touchCommand.touchPosition.Y.ToString("0.0000", formatLocale) + "," + touchCommand.touchSize.X.ToString("0.0000", formatLocale) + "," + touchCommand.touchSize.Y.ToString("0.0000", formatLocale) + "],";
} }
touchCommandString = touchCommandString.Remove(touchCommandString.Length - 1); touchCommandString = touchCommandString.Remove(touchCommandString.Length - 1);
touchCommandString += "]}"; touchCommandString += "]}";
GD.Print(touchCommandString);
_wsPeer.Send(Encoding.UTF8.GetBytes(touchCommandString)); _wsPeer.Send(Encoding.UTF8.GetBytes(touchCommandString));
} }
} }

View File

@ -15,6 +15,6 @@ public partial class SensorTrigger : Area3D
// Called every frame. 'delta' is the elapsed time since the previous frame. // Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta) public override void _Process(double delta)
{ {
rayCast.Rotation = Vector3.Zero; rayCast.GlobalRotation = Vector3.Zero;
} }
} }