Skip to content

Commit 5c35eae

Browse files
committed
Fix spawning of cube as new wepon for now, remove Position3D that is not needed
1 parent 8b9597c commit 5c35eae

3 files changed

Lines changed: 45 additions & 40 deletions

File tree

src/scenes/Player.tscn

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -70,41 +70,38 @@ ui_raycast_length = 6.0
7070

7171
[node name="LeftHand" type="ARVRController" parent="ARVROrigin"]
7272
script = ExtResource( 3 )
73-
velocity_track_point = NodePath("Position3D/Position3D/EndTracker")
73+
velocity_track_point = NodePath("Position3D/EndTracker")
7474

7575
[node name="LeftHand" parent="ARVROrigin/LeftHand" instance=ExtResource( 2 )]
7676
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0448227, 0.147459 )
7777
visible = false
7878

7979
[node name="Position3D" type="Position3D" parent="ARVROrigin/LeftHand"]
80-
transform = Transform( 1, 0, 0, 0, 0.819152, -0.573577, 0, 0.573577, 0.819152, 0, 0, 0 )
80+
transform = Transform( 1, 0, 0, 0, 0.819152, -0.573577, 0, 0.573577, 0.819152, 0, 0.216239, -0.30882 )
8181

82-
[node name="Position3D" type="Position3D" parent="ARVROrigin/LeftHand/Position3D"]
83-
transform = Transform( 1, 0, 0, 0, 1, -2.98023e-08, 0, 2.98023e-08, 1, 0, 0, -0.377 )
84-
85-
[node name="EndTracker" type="Position3D" parent="ARVROrigin/LeftHand/Position3D/Position3D"]
82+
[node name="EndTracker" type="Position3D" parent="ARVROrigin/LeftHand/Position3D"]
8683
transform = Transform( 1, 0, 0, 0, 1, -2.98023e-08, 0, 2.98023e-08, 1, 0, 0, -0.37 )
8784

88-
[node name="Area" type="Area" parent="ARVROrigin/LeftHand/Position3D/Position3D"]
85+
[node name="Area" type="Area" parent="ARVROrigin/LeftHand/Position3D"]
8986
collision_layer = 2
9087
collision_mask = 28
9188

92-
[node name="CollisionShape3" type="CollisionShape" parent="ARVROrigin/LeftHand/Position3D/Position3D/Area"]
89+
[node name="CollisionShape3" type="CollisionShape" parent="ARVROrigin/LeftHand/Position3D/Area"]
9390
shape = SubResource( 16 )
9491

95-
[node name="Feature_UIRayCast" parent="ARVROrigin/LeftHand/Position3D/Position3D" instance=ExtResource( 5 )]
96-
controller = NodePath("../../..")
92+
[node name="Feature_UIRayCast" parent="ARVROrigin/LeftHand/Position3D" instance=ExtResource( 5 )]
93+
controller = NodePath("../..")
9794
ui_raycast_length = 5.0
9895

99-
[node name="Weapon" type="Spatial" parent="ARVROrigin/LeftHand/Position3D/Position3D"]
96+
[node name="Weapon" type="Spatial" parent="ARVROrigin/LeftHand/Position3D"]
10097

101-
[node name="Handle" type="MeshInstance" parent="ARVROrigin/LeftHand/Position3D/Position3D/Weapon"]
98+
[node name="Handle" type="MeshInstance" parent="ARVROrigin/LeftHand/Position3D/Weapon"]
10299
transform = Transform( 1, 0, 0, 0, -1.19209e-07, -1, 0, 1, -1.19209e-07, 0, 1.11759e-08, 0.45 )
103100
mesh = SubResource( 20 )
104101
skeleton = NodePath("../..")
105102
material/0 = SubResource( 21 )
106103

107-
[node name="Blade" type="MeshInstance" parent="ARVROrigin/LeftHand/Position3D/Position3D/Weapon"]
104+
[node name="Blade" type="MeshInstance" parent="ARVROrigin/LeftHand/Position3D/Weapon"]
108105
transform = Transform( 1, 0, 0, 0, 1, -2.98023e-08, 0, 2.98023e-08, 1, 0, 0, 0 )
109106
mesh = SubResource( 17 )
110107
skeleton = NodePath("../..")
@@ -113,44 +110,41 @@ material/0 = SubResource( 19 )
113110
[node name="RightHand" type="ARVRController" parent="ARVROrigin"]
114111
controller_id = 2
115112
script = ExtResource( 3 )
116-
velocity_track_point = NodePath("Position3D/Position3D/EndTracker")
113+
velocity_track_point = NodePath("Position3D/EndTracker")
117114

118115
[node name="HandModel" parent="ARVROrigin/RightHand" instance=ExtResource( 1 )]
119116
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.045, 0.147 )
120117
visible = false
121118

122119
[node name="Position3D" type="Position3D" parent="ARVROrigin/RightHand"]
123-
transform = Transform( 1, 0, 0, 0, 0.819152, -0.573577, 0, 0.573577, 0.819152, 0, 0, 0 )
124-
125-
[node name="Position3D" type="Position3D" parent="ARVROrigin/RightHand/Position3D"]
126-
transform = Transform( 1, 0, 0, 0, 1, -2.98023e-08, 0, 2.98023e-08, 1, 0, 0, -0.377 )
120+
transform = Transform( 1, 0, 0, 0, 0.819152, -0.573577, 0, 0.573577, 0.819152, 0, 0.216239, -0.30882 )
127121

128-
[node name="EndTracker" type="Position3D" parent="ARVROrigin/RightHand/Position3D/Position3D"]
122+
[node name="EndTracker" type="Position3D" parent="ARVROrigin/RightHand/Position3D"]
129123
transform = Transform( 1, 0, 0, 0, 1, -2.98023e-08, 0, 2.98023e-08, 1, 0, 5.96046e-08, -0.37 )
130124

131-
[node name="Area" type="Area" parent="ARVROrigin/RightHand/Position3D/Position3D"]
125+
[node name="Area" type="Area" parent="ARVROrigin/RightHand/Position3D"]
132126
collision_layer = 2
133127
collision_mask = 28
134128

135-
[node name="CollisionShape2" type="CollisionShape" parent="ARVROrigin/RightHand/Position3D/Position3D/Area"]
129+
[node name="CollisionShape2" type="CollisionShape" parent="ARVROrigin/RightHand/Position3D/Area"]
136130
shape = SubResource( 16 )
137131

138-
[node name="Feature_UIRayCast" parent="ARVROrigin/RightHand/Position3D/Position3D" instance=ExtResource( 5 )]
139-
controller = NodePath("../../..")
132+
[node name="Feature_UIRayCast" parent="ARVROrigin/RightHand/Position3D" instance=ExtResource( 5 )]
133+
controller = NodePath("../..")
140134
ui_raycast_length = 5.0
141135

142-
[node name="Weapon" type="Spatial" parent="ARVROrigin/RightHand/Position3D/Position3D"]
136+
[node name="Weapon" type="Spatial" parent="ARVROrigin/RightHand/Position3D"]
143137

144-
[node name="Handle" type="MeshInstance" parent="ARVROrigin/RightHand/Position3D/Position3D/Weapon"]
138+
[node name="Handle" type="MeshInstance" parent="ARVROrigin/RightHand/Position3D/Weapon"]
145139
transform = Transform( 1, 0, 0, 0, -8.9407e-08, -1, 0, 1, -8.9407e-08, 0, 1.11759e-08, 0.45 )
146140
mesh = SubResource( 20 )
147141
skeleton = NodePath("../Blade")
148142
material/0 = SubResource( 21 )
149143

150-
[node name="Blade" type="MeshInstance" parent="ARVROrigin/RightHand/Position3D/Position3D/Weapon"]
144+
[node name="Blade" type="MeshInstance" parent="ARVROrigin/RightHand/Position3D/Weapon"]
151145
transform = Transform( 1, 0, 0, 0, 1, -2.98023e-08, 0, 2.98023e-08, 1, 0, 0, 0 )
152146
mesh = SubResource( 17 )
153-
skeleton = NodePath("../../..")
147+
skeleton = NodePath("")
154148
material/0 = SubResource( 18 )
155149

156150
[node name="PauseLabel" parent="ARVROrigin" instance=ExtResource( 9 )]
@@ -241,12 +235,12 @@ stream = ExtResource( 6 )
241235
[node name="PlayerCenter" parent="." instance=ExtResource( 11 )]
242236

243237
[connection signal="area_entered" from="ARVROrigin/ARVRCamera/HeadArea" to="." method="_on_HeadArea_area_entered"]
244-
[connection signal="area_entered" from="ARVROrigin/LeftHand/Position3D/Position3D/Area" to="." method="_on_Area_area_entered_left"]
245-
[connection signal="body_entered" from="ARVROrigin/LeftHand/Position3D/Position3D/Area" to="." method="_on_left_hand_body_entered"]
246-
[connection signal="body_exited" from="ARVROrigin/LeftHand/Position3D/Position3D/Area" to="." method="_on_Area_body_exited_left"]
247-
[connection signal="area_entered" from="ARVROrigin/RightHand/Position3D/Position3D/Area" to="." method="_on_Area_area_entered_right"]
248-
[connection signal="body_entered" from="ARVROrigin/RightHand/Position3D/Position3D/Area" to="." method="_on_right_hand_body_entered"]
249-
[connection signal="body_exited" from="ARVROrigin/RightHand/Position3D/Position3D/Area" to="." method="_on_Area_body_exited_right"]
238+
[connection signal="area_entered" from="ARVROrigin/LeftHand/Position3D/Area" to="." method="_on_Area_area_entered_left"]
239+
[connection signal="body_entered" from="ARVROrigin/LeftHand/Position3D/Area" to="." method="_on_left_hand_body_entered"]
240+
[connection signal="body_exited" from="ARVROrigin/LeftHand/Position3D/Area" to="." method="_on_Area_body_exited_left"]
241+
[connection signal="area_entered" from="ARVROrigin/RightHand/Position3D/Area" to="." method="_on_Area_area_entered_right"]
242+
[connection signal="body_entered" from="ARVROrigin/RightHand/Position3D/Area" to="." method="_on_right_hand_body_entered"]
243+
[connection signal="body_exited" from="ARVROrigin/RightHand/Position3D/Area" to="." method="_on_Area_body_exited_right"]
250244
[connection signal="pressed" from="ARVROrigin/PauseLabel/PauseContainer/PauseBtns/ResumeBtn" to="." method="_on_ResumeBtn_pressed"]
251245
[connection signal="pressed" from="ARVROrigin/PauseLabel/PauseContainer/PauseBtns/RestartBtn" to="." method="_on_RestartBtn_pressed"]
252246
[connection signal="pressed" from="ARVROrigin/PauseLabel/PauseContainer/PauseBtns/MenuBtn" to="." method="_on_MenuBtn_pressed"]

src/scripts/GameVariables.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const UI_PIXELS_TO_METER = 1.0 / 512
44

55

66
# Don't edit
7-
export var vr_enabled = false
7+
export var vr_enabled = true
88

99
var ENABLE_VR = true
1010

src/scripts/MainMenu.gd

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,24 @@ func switch_weapon(index):
3333
print("Switching wapon")
3434

3535
if GameVariables.ENABLE_VR:
36-
var weapon = MeshInstance.new()
37-
weapon.mesh = CubeMesh.new()
36+
var left_weapon = MeshInstance.new()
37+
left_weapon.mesh = CubeMesh.new()
38+
left_weapon.global_scale(Vector3(0.1, 0.1, 0.1))
3839

39-
remove_children(_player.get_node("ARVROrigin/LeftHand/Position3D/Position3D/Weapon"))
40-
_player.get_node("ARVROrigin/LeftHand/Position3D/Position3D/Weapon").add_child(weapon)
40+
var right_weapon = MeshInstance.new()
41+
right_weapon.mesh = CubeMesh.new()
42+
right_weapon.global_scale(Vector3(0.1, 0.1, 0.1))
4143

42-
remove_children(_player.get_node("ARVROrigin/RightHand/Position3D/Position3D/Weapon"))
43-
_player.get_node("ARVROrigin/RightHand/Position3D/Position3D/Weapon").add_child(weapon)
44+
45+
var left_controller_node = _player.get_node("ARVROrigin/LeftHand/Position3D/Weapon")
46+
var right_controller_node = _player.get_node("ARVROrigin/RightHand/Position3D/Weapon")
47+
48+
remove_children(left_controller_node)
49+
left_weapon.to_global(left_controller_node.global_transform.origin)
50+
left_controller_node.add_child(left_weapon)
51+
52+
remove_children(right_controller_node)
53+
right_weapon.to_global(right_controller_node.global_transform.origin)
54+
right_controller_node.add_child(right_weapon)
4455

4556

0 commit comments

Comments
 (0)