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

REAL FOOT TRACKER SUPPORT, controller labels, always point raycast down

This commit is contained in:
RubberDuckShobe 2023-08-22 16:40:40 +02:00
parent 422d2d4aac
commit 8e4b05ac4d
5 changed files with 56 additions and 12 deletions

View File

@ -90,6 +90,12 @@ tracker = &"left_hand"
[node name="Virtual Foot" parent="XROrigin3D/LeftHand" instance=ExtResource("6_ss0nc")] [node name="Virtual Foot" parent="XROrigin3D/LeftHand" instance=ExtResource("6_ss0nc")]
[node name="Label" type="Label3D" parent="XROrigin3D/LeftHand/Virtual Foot"]
transform = Transform3D(0.08, 0, 0, 0, -3.49691e-09, 0.08, 0, -0.08, -3.49691e-09, 0, 0.052, 0)
text = "Hand
L"
font_size = 64
[node name="RightHand" type="XRController3D" parent="XROrigin3D"] [node name="RightHand" type="XRController3D" parent="XROrigin3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 1, -0.5) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 1, -0.5)
tracker = &"right_hand" tracker = &"right_hand"
@ -97,6 +103,38 @@ tracker = &"right_hand"
[node name="Virtual Foot" parent="XROrigin3D/RightHand" instance=ExtResource("6_ss0nc")] [node name="Virtual Foot" parent="XROrigin3D/RightHand" instance=ExtResource("6_ss0nc")]
sensorId = 1 sensorId = 1
[node name="Label" type="Label3D" parent="XROrigin3D/RightHand/Virtual Foot"]
transform = Transform3D(0.08, 0, 0, 0, -3.49691e-09, 0.08, 0, -0.08, -3.49691e-09, 0, 0.052, 0)
text = "Hand
R"
font_size = 64
[node name="LeftFoot" type="XRController3D" parent="XROrigin3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.25, 0, -1)
tracker = &"/user/vive_tracker_htcx/role/left_foot"
[node name="Virtual Foot" parent="XROrigin3D/LeftFoot" instance=ExtResource("6_ss0nc")]
sensorId = 2
[node name="Label" type="Label3D" parent="XROrigin3D/LeftFoot/Virtual Foot"]
transform = Transform3D(0.08, 0, 0, 0, -3.49691e-09, 0.08, 0, -0.08, -3.49691e-09, 0, 0.052, 0)
text = "Foot
L"
font_size = 64
[node name="RightFoot" type="XRController3D" parent="XROrigin3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.25, 0, -1)
tracker = &"/user/vive_tracker_htcx/role/right_foot"
[node name="Virtual Foot" parent="XROrigin3D/RightFoot" instance=ExtResource("6_ss0nc")]
sensorId = 3
[node name="Label" type="Label3D" parent="XROrigin3D/RightFoot/Virtual Foot"]
transform = Transform3D(0.08, 0, 0, 0, -3.49691e-09, 0.08, 0, -0.08, -3.49691e-09, 0, 0.052, 0)
text = "Foot
R"
font_size = 64
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.445432, 0.895316, 0, -0.895316, 0.445432, 0, 5.43573, -0.011737) transform = Transform3D(1, 0, 0, 0, 0.445432, 0.895316, 0, -0.895316, 0.445432, 0, 5.43573, -0.011737)
@ -107,10 +145,10 @@ environment = SubResource("Environment_jj1ls")
script = ExtResource("5_44hhi") script = ExtResource("5_44hhi")
_footSensor = NodePath("../XROrigin3D/Foot Sensor Pad") _footSensor = NodePath("../XROrigin3D/Foot Sensor Pad")
[node name="Action Handler" type="Node" parent="." node_paths=PackedStringArray("_leftFoot", "_rightFoot")] [node name="Action Handler" type="Node" parent="." node_paths=PackedStringArray("_leftHand", "_rightHand")]
script = ExtResource("8_a7ujv") script = ExtResource("8_a7ujv")
_leftFoot = NodePath("../XROrigin3D/LeftHand/Virtual Foot") _leftHand = NodePath("../XROrigin3D/LeftHand/Virtual Foot")
_rightFoot = NodePath("../XROrigin3D/RightHand/Virtual Foot") _rightHand = NodePath("../XROrigin3D/RightHand/Virtual Foot")
[connection signal="button_pressed" from="XROrigin3D/LeftHand" to="Action Handler" method="OnXRButtonPress"] [connection signal="button_pressed" from="XROrigin3D/LeftHand" to="Action Handler" method="OnXRButtonPress"]
[connection signal="button_pressed" from="XROrigin3D/RightHand" to="Action Handler" method="OnXRButtonPress"] [connection signal="button_pressed" from="XROrigin3D/RightHand" to="Action Handler" method="OnXRButtonPress"]

View File

@ -4,9 +4,9 @@ using System;
public partial class ActionHandler : Node public partial class ActionHandler : Node
{ {
[Export] [Export]
private Node3D _leftFoot; private Node3D _leftHand;
[Export] [Export]
private Node3D _rightFoot; private Node3D _rightHand;
// Called when the node enters the scene tree for the first time. // Called when the node enters the scene tree for the first time.
public override void _Ready() public override void _Ready()
@ -29,12 +29,12 @@ public partial class ActionHandler : Node
private void Recalibrate() private void Recalibrate()
{ {
GD.Print("Recalibrating feet"); GD.Print("Recalibrating hands");
const float defaultFootHeight = 0.075f; const float defaultFootHeight = 0.038f;
_leftFoot.GlobalRotation = Vector3.Zero; _leftHand.GlobalRotation = Vector3.Zero;
_rightFoot.GlobalRotation = Vector3.Zero; _rightHand.GlobalRotation = Vector3.Zero;
_leftFoot.GlobalPosition = new Vector3(_leftFoot.GlobalPosition.X, defaultFootHeight, _leftFoot.GlobalPosition.Z); _leftHand.GlobalPosition = new Vector3(_leftHand.GlobalPosition.X, defaultFootHeight, _leftHand.GlobalPosition.Z);
_rightFoot.GlobalPosition = new Vector3(_rightFoot.GlobalPosition.X, defaultFootHeight, _rightFoot.GlobalPosition.Z); _rightHand.GlobalPosition = new Vector3(_rightHand.GlobalPosition.X, defaultFootHeight, _rightHand.GlobalPosition.Z);
} }
} }

View File

@ -34,6 +34,7 @@ public partial class GameConnection : Node
} }
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

@ -4,6 +4,8 @@ public partial class SensorTrigger : Area3D
{ {
[Export] [Export]
public int sensorId; public int sensorId;
[Export]
public RayCast3D rayCast;
// Called when the node enters the scene tree for the first time. // Called when the node enters the scene tree for the first time.
public override void _Ready() public override void _Ready()
@ -13,5 +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;
} }
} }

View File

@ -7,15 +7,17 @@
[sub_resource type="BoxMesh" id="BoxMesh_a5ph8"] [sub_resource type="BoxMesh" id="BoxMesh_a5ph8"]
size = Vector3(0.04, 0.015, 0.05) size = Vector3(0.04, 0.015, 0.05)
[node name="Virtual Foot" type="Area3D"] [node name="Virtual Foot" type="Area3D" node_paths=PackedStringArray("rayCast")]
collision_layer = 2 collision_layer = 2
collision_mask = 2 collision_mask = 2
script = ExtResource("1_aibvx") script = ExtResource("1_aibvx")
rayCast = NodePath("RayCast3D")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."] [node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = ExtResource("2_vuma2") shape = ExtResource("2_vuma2")
[node name="RayCast3D" type="RayCast3D" parent="."] [node name="RayCast3D" type="RayCast3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0377305, 0)
collision_mask = 4 collision_mask = 4
[node name="MeshInstance3D" type="MeshInstance3D" parent="."] [node name="MeshInstance3D" type="MeshInstance3D" parent="."]