properly disable hands on controllers
This commit is contained in:
parent
ad9245a922
commit
111a7c2558
|
@ -7,7 +7,7 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://pk5k1q8bx0rj" path="res://content/ui/components/slider/slider.tscn" id="4_t8xp5"]
|
[ext_resource type="PackedScene" uid="uid://pk5k1q8bx0rj" path="res://content/ui/components/slider/slider.tscn" id="4_t8xp5"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="5_opf0y"]
|
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="5_opf0y"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_p3rs7"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ikxbe"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
render_priority = 10
|
render_priority = 10
|
||||||
shader = ExtResource("2_wwobq")
|
shader = ExtResource("2_wwobq")
|
||||||
|
@ -22,7 +22,7 @@ shader_parameter/corner_radius = 0.2
|
||||||
shader_parameter/roughness = 0.3
|
shader_parameter/roughness = 0.3
|
||||||
shader_parameter/grain_amount = 0.02
|
shader_parameter/grain_amount = 0.02
|
||||||
|
|
||||||
[sub_resource type="QuadMesh" id="QuadMesh_nlygn"]
|
[sub_resource type="QuadMesh" id="QuadMesh_qfg01"]
|
||||||
size = Vector2(0.3, 0.2)
|
size = Vector2(0.3, 0.2)
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_ctomk"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_ctomk"]
|
||||||
|
@ -34,8 +34,8 @@ collision_mask = 0
|
||||||
script = ExtResource("1_1ixy6")
|
script = ExtResource("1_1ixy6")
|
||||||
|
|
||||||
[node name="Panel" parent="." instance=ExtResource("1_myvk1")]
|
[node name="Panel" parent="." instance=ExtResource("1_myvk1")]
|
||||||
material_override = SubResource("ShaderMaterial_p3rs7")
|
material_override = SubResource("ShaderMaterial_ikxbe")
|
||||||
mesh = SubResource("QuadMesh_nlygn")
|
mesh = SubResource("QuadMesh_qfg01")
|
||||||
skeleton = NodePath("../..")
|
skeleton = NodePath("../..")
|
||||||
size = Vector2(0.3, 0.2)
|
size = Vector2(0.3, 0.2)
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="3_2gpr3"]
|
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="3_2gpr3"]
|
||||||
[ext_resource type="PackedScene" uid="uid://blrhy2uccrdn4" path="res://content/ui/components/input/input.tscn" id="4_upyp3"]
|
[ext_resource type="PackedScene" uid="uid://blrhy2uccrdn4" path="res://content/ui/components/input/input.tscn" id="4_upyp3"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_e3jsi"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_00j7x"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
render_priority = 10
|
render_priority = 10
|
||||||
shader = ExtResource("2_m4moa")
|
shader = ExtResource("2_m4moa")
|
||||||
|
@ -21,7 +21,7 @@ shader_parameter/corner_radius = 0.2
|
||||||
shader_parameter/roughness = 0.3
|
shader_parameter/roughness = 0.3
|
||||||
shader_parameter/grain_amount = 0.02
|
shader_parameter/grain_amount = 0.02
|
||||||
|
|
||||||
[sub_resource type="QuadMesh" id="QuadMesh_bmhxb"]
|
[sub_resource type="QuadMesh" id="QuadMesh_3236q"]
|
||||||
size = Vector2(0.3, 0.25)
|
size = Vector2(0.3, 0.25)
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_bu024"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_bu024"]
|
||||||
|
@ -34,8 +34,8 @@ script = ExtResource("1_gw2gi")
|
||||||
|
|
||||||
[node name="Panel" parent="." instance=ExtResource("1_78ups")]
|
[node name="Panel" parent="." instance=ExtResource("1_78ups")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -7.45058e-09, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -7.45058e-09, 0)
|
||||||
material_override = SubResource("ShaderMaterial_e3jsi")
|
material_override = SubResource("ShaderMaterial_00j7x")
|
||||||
mesh = SubResource("QuadMesh_bmhxb")
|
mesh = SubResource("QuadMesh_3236q")
|
||||||
skeleton = NodePath("../..")
|
skeleton = NodePath("../..")
|
||||||
size = Vector2(0.3, 0.25)
|
size = Vector2(0.3, 0.25)
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://blrhy2uccrdn4" path="res://content/ui/components/input/input.tscn" id="5_ecnnd"]
|
[ext_resource type="PackedScene" uid="uid://blrhy2uccrdn4" path="res://content/ui/components/input/input.tscn" id="5_ecnnd"]
|
||||||
[ext_resource type="PackedScene" uid="uid://wgnowarejk5y" path="res://content/ui/components/select/select.tscn" id="6_egqee"]
|
[ext_resource type="PackedScene" uid="uid://wgnowarejk5y" path="res://content/ui/components/select/select.tscn" id="6_egqee"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_s8u61"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_pqb3y"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
render_priority = 10
|
render_priority = 10
|
||||||
shader = ExtResource("3_vjmg5")
|
shader = ExtResource("3_vjmg5")
|
||||||
|
@ -22,7 +22,7 @@ shader_parameter/corner_radius = 0.2
|
||||||
shader_parameter/roughness = 0.3
|
shader_parameter/roughness = 0.3
|
||||||
shader_parameter/grain_amount = 0.02
|
shader_parameter/grain_amount = 0.02
|
||||||
|
|
||||||
[sub_resource type="QuadMesh" id="QuadMesh_4hbc0"]
|
[sub_resource type="QuadMesh" id="QuadMesh_b6qk4"]
|
||||||
size = Vector2(0.3, 0.2)
|
size = Vector2(0.3, 0.2)
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_53oq0"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_53oq0"]
|
||||||
|
@ -34,8 +34,8 @@ collision_mask = 0
|
||||||
script = ExtResource("1_xxfkt")
|
script = ExtResource("1_xxfkt")
|
||||||
|
|
||||||
[node name="Panel" parent="." instance=ExtResource("2_4g761")]
|
[node name="Panel" parent="." instance=ExtResource("2_4g761")]
|
||||||
material_override = SubResource("ShaderMaterial_s8u61")
|
material_override = SubResource("ShaderMaterial_pqb3y")
|
||||||
mesh = SubResource("QuadMesh_4hbc0")
|
mesh = SubResource("QuadMesh_b6qk4")
|
||||||
skeleton = NodePath("../..")
|
skeleton = NodePath("../..")
|
||||||
size = Vector2(0.3, 0.2)
|
size = Vector2(0.3, 0.2)
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="4_u2igx"]
|
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="4_u2igx"]
|
||||||
[ext_resource type="PackedScene" uid="uid://blrhy2uccrdn4" path="res://content/ui/components/input/input.tscn" id="5_1jm5m"]
|
[ext_resource type="PackedScene" uid="uid://blrhy2uccrdn4" path="res://content/ui/components/input/input.tscn" id="5_1jm5m"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_j16so"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ncmoa"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
render_priority = 10
|
render_priority = 10
|
||||||
shader = ExtResource("3_abcrk")
|
shader = ExtResource("3_abcrk")
|
||||||
|
@ -21,7 +21,7 @@ shader_parameter/corner_radius = 0.2
|
||||||
shader_parameter/roughness = 0.3
|
shader_parameter/roughness = 0.3
|
||||||
shader_parameter/grain_amount = 0.02
|
shader_parameter/grain_amount = 0.02
|
||||||
|
|
||||||
[sub_resource type="QuadMesh" id="QuadMesh_48hjm"]
|
[sub_resource type="QuadMesh" id="QuadMesh_qm2qb"]
|
||||||
size = Vector2(0.3, 0.2)
|
size = Vector2(0.3, 0.2)
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_53oq0"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_53oq0"]
|
||||||
|
@ -31,8 +31,8 @@ size = Vector3(0.3, 0.2, 0.02)
|
||||||
script = ExtResource("1_03bil")
|
script = ExtResource("1_03bil")
|
||||||
|
|
||||||
[node name="Panel" parent="." instance=ExtResource("2_kt6qc")]
|
[node name="Panel" parent="." instance=ExtResource("2_kt6qc")]
|
||||||
material_override = SubResource("ShaderMaterial_j16so")
|
material_override = SubResource("ShaderMaterial_ncmoa")
|
||||||
mesh = SubResource("QuadMesh_48hjm")
|
mesh = SubResource("QuadMesh_qm2qb")
|
||||||
skeleton = NodePath("../..")
|
skeleton = NodePath("../..")
|
||||||
size = Vector2(0.3, 0.2)
|
size = Vector2(0.3, 0.2)
|
||||||
|
|
||||||
|
|
|
@ -125,9 +125,9 @@ func _setup_hand():
|
||||||
auto_hand.hand_active_changed.connect(func(hand: int, active: bool):
|
auto_hand.hand_active_changed.connect(func(hand: int, active: bool):
|
||||||
if hand != 0: return
|
if hand != 0: return
|
||||||
|
|
||||||
hand_active=active
|
hand_active=active&&_is_hand_simulated() == false
|
||||||
|
|
||||||
$IndexTip/TouchArea/CollisionShape3D.disabled=!active
|
$IndexTip/TouchArea/CollisionShape3D.disabled=!hand_active
|
||||||
hand_mesh.visible=active
|
hand_mesh.visible=active
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -155,6 +155,17 @@ func _setup_hand():
|
||||||
pointer = Pointer.new(initiator, ray)
|
pointer = Pointer.new(initiator, ray)
|
||||||
add_child(pointer)
|
add_child(pointer)
|
||||||
|
|
||||||
|
func _is_hand_simulated():
|
||||||
|
var hand_trackers = XRServer.get_trackers(XRServer.TRACKER_HAND)
|
||||||
|
|
||||||
|
for tracker in hand_trackers.values():
|
||||||
|
if tracker.hand != XRPositionalTracker.TrackerHand.TRACKER_HAND_LEFT:
|
||||||
|
continue
|
||||||
|
|
||||||
|
return tracker.hand_tracking_source == XRHandTracker.HAND_TRACKING_SOURCE_CONTROLLER
|
||||||
|
|
||||||
|
return false
|
||||||
|
|
||||||
func _get_entity(node: Node):
|
func _get_entity(node: Node):
|
||||||
if node is Entity:
|
if node is Entity:
|
||||||
return node
|
return node
|
||||||
|
|
|
@ -56,9 +56,9 @@ func _setup_hand():
|
||||||
auto_hand.hand_active_changed.connect(func(hand: int, active: bool):
|
auto_hand.hand_active_changed.connect(func(hand: int, active: bool):
|
||||||
if hand != 1: return
|
if hand != 1: return
|
||||||
|
|
||||||
hand_active=active
|
hand_active=active&&_is_hand_simulated() == false
|
||||||
|
|
||||||
$IndexTip/TouchArea/CollisionShape3D.disabled=!active
|
$IndexTip/TouchArea/CollisionShape3D.disabled=!hand_active
|
||||||
hand_mesh.visible=active
|
hand_mesh.visible=active
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -83,4 +83,15 @@ func _physics_process(_delta):
|
||||||
grabbed = true
|
grabbed = true
|
||||||
elif !grab_close&&grabbed:
|
elif !grab_close&&grabbed:
|
||||||
pointer.released(Initiator.EventType.GRIP)
|
pointer.released(Initiator.EventType.GRIP)
|
||||||
grabbed = false
|
grabbed = false
|
||||||
|
|
||||||
|
func _is_hand_simulated():
|
||||||
|
var hand_trackers = XRServer.get_trackers(XRServer.TRACKER_HAND)
|
||||||
|
|
||||||
|
for tracker in hand_trackers.values():
|
||||||
|
if tracker.hand != XRPositionalTracker.TrackerHand.TRACKER_HAND_RIGHT:
|
||||||
|
continue
|
||||||
|
|
||||||
|
return tracker.hand_tracking_source == XRHandTracker.HAND_TRACKING_SOURCE_CONTROLLER
|
||||||
|
|
||||||
|
return false
|
|
@ -29,6 +29,9 @@ mesh = SubResource("BoxMesh_ir3co")
|
||||||
|
|
||||||
[node name="AutoHandtracker" parent="." instance=ExtResource("3_pjmb2")]
|
[node name="AutoHandtracker" parent="." instance=ExtResource("3_pjmb2")]
|
||||||
visible = false
|
visible = false
|
||||||
|
applymiddlefingerfix = null
|
||||||
|
applyscaling = null
|
||||||
|
coincidewristorknuckle = null
|
||||||
visiblehandtrackskeleton = false
|
visiblehandtrackskeleton = false
|
||||||
enableautotracker = false
|
enableautotracker = false
|
||||||
|
|
||||||
|
|
|
@ -63,22 +63,22 @@ void fragment() {
|
||||||
ROUGHNESS = roughness;
|
ROUGHNESS = roughness;
|
||||||
DEPTH = FRAGCOORD.z + 0.0001;
|
DEPTH = FRAGCOORD.z + 0.0001;
|
||||||
ALBEDO = vec3(color.xyz);
|
ALBEDO = vec3(color.xyz);
|
||||||
|
|
||||||
vec2 pos = vec2(UV.x * aspect_ratio.x, UV.y * aspect_ratio.y);
|
vec2 pos = vec2(UV.x * aspect_ratio.x, UV.y * aspect_ratio.y);
|
||||||
float border = 0.05;
|
float border = 0.05;
|
||||||
|
|
||||||
if (pos.x <= border) {
|
if (pos.x <= border) {
|
||||||
ALBEDO = mix(vec3(0.0), ALBEDO, pos.x / border);
|
ALBEDO = mix(vec3(0.0), ALBEDO, pos.x / border);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos.x >= aspect_ratio.x - border) {
|
if (pos.x >= aspect_ratio.x - border) {
|
||||||
ALBEDO = mix(vec3(0.0), ALBEDO, 1.0 - (pos.x - (aspect_ratio.x - border)) / border);
|
ALBEDO = mix(vec3(0.0), ALBEDO, 1.0 - (pos.x - (aspect_ratio.x - border)) / border);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos.y <= border) {
|
if (pos.y <= border) {
|
||||||
ALBEDO = mix(vec3(0.0), ALBEDO, pos.y / border);
|
ALBEDO = mix(vec3(0.0), ALBEDO, pos.y / border);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos.y >= aspect_ratio.y - border) {
|
if (pos.y >= aspect_ratio.y - border) {
|
||||||
ALBEDO = mix(vec3(0.0), ALBEDO, 1.0 - (pos.y - (aspect_ratio.y - border)) / border);
|
ALBEDO = mix(vec3(0.0), ALBEDO, 1.0 - (pos.y - (aspect_ratio.y - border)) / border);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user