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://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
|
||||
render_priority = 10
|
||||
shader = ExtResource("2_wwobq")
|
||||
|
@ -22,7 +22,7 @@ shader_parameter/corner_radius = 0.2
|
|||
shader_parameter/roughness = 0.3
|
||||
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)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_ctomk"]
|
||||
|
@ -34,8 +34,8 @@ collision_mask = 0
|
|||
script = ExtResource("1_1ixy6")
|
||||
|
||||
[node name="Panel" parent="." instance=ExtResource("1_myvk1")]
|
||||
material_override = SubResource("ShaderMaterial_p3rs7")
|
||||
mesh = SubResource("QuadMesh_nlygn")
|
||||
material_override = SubResource("ShaderMaterial_ikxbe")
|
||||
mesh = SubResource("QuadMesh_qfg01")
|
||||
skeleton = NodePath("../..")
|
||||
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://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
|
||||
render_priority = 10
|
||||
shader = ExtResource("2_m4moa")
|
||||
|
@ -21,7 +21,7 @@ shader_parameter/corner_radius = 0.2
|
|||
shader_parameter/roughness = 0.3
|
||||
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)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_bu024"]
|
||||
|
@ -34,8 +34,8 @@ script = ExtResource("1_gw2gi")
|
|||
|
||||
[node name="Panel" parent="." instance=ExtResource("1_78ups")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -7.45058e-09, 0)
|
||||
material_override = SubResource("ShaderMaterial_e3jsi")
|
||||
mesh = SubResource("QuadMesh_bmhxb")
|
||||
material_override = SubResource("ShaderMaterial_00j7x")
|
||||
mesh = SubResource("QuadMesh_3236q")
|
||||
skeleton = NodePath("../..")
|
||||
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://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
|
||||
render_priority = 10
|
||||
shader = ExtResource("3_vjmg5")
|
||||
|
@ -22,7 +22,7 @@ shader_parameter/corner_radius = 0.2
|
|||
shader_parameter/roughness = 0.3
|
||||
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)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_53oq0"]
|
||||
|
@ -34,8 +34,8 @@ collision_mask = 0
|
|||
script = ExtResource("1_xxfkt")
|
||||
|
||||
[node name="Panel" parent="." instance=ExtResource("2_4g761")]
|
||||
material_override = SubResource("ShaderMaterial_s8u61")
|
||||
mesh = SubResource("QuadMesh_4hbc0")
|
||||
material_override = SubResource("ShaderMaterial_pqb3y")
|
||||
mesh = SubResource("QuadMesh_b6qk4")
|
||||
skeleton = NodePath("../..")
|
||||
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://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
|
||||
render_priority = 10
|
||||
shader = ExtResource("3_abcrk")
|
||||
|
@ -21,7 +21,7 @@ shader_parameter/corner_radius = 0.2
|
|||
shader_parameter/roughness = 0.3
|
||||
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)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_53oq0"]
|
||||
|
@ -31,8 +31,8 @@ size = Vector3(0.3, 0.2, 0.02)
|
|||
script = ExtResource("1_03bil")
|
||||
|
||||
[node name="Panel" parent="." instance=ExtResource("2_kt6qc")]
|
||||
material_override = SubResource("ShaderMaterial_j16so")
|
||||
mesh = SubResource("QuadMesh_48hjm")
|
||||
material_override = SubResource("ShaderMaterial_ncmoa")
|
||||
mesh = SubResource("QuadMesh_qm2qb")
|
||||
skeleton = NodePath("../..")
|
||||
size = Vector2(0.3, 0.2)
|
||||
|
||||
|
|
|
@ -125,9 +125,9 @@ func _setup_hand():
|
|||
auto_hand.hand_active_changed.connect(func(hand: int, active: bool):
|
||||
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
|
||||
)
|
||||
|
||||
|
@ -155,6 +155,17 @@ func _setup_hand():
|
|||
pointer = Pointer.new(initiator, ray)
|
||||
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):
|
||||
if node is Entity:
|
||||
return node
|
||||
|
|
|
@ -56,9 +56,9 @@ func _setup_hand():
|
|||
auto_hand.hand_active_changed.connect(func(hand: int, active: bool):
|
||||
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
|
||||
)
|
||||
|
||||
|
@ -84,3 +84,14 @@ func _physics_process(_delta):
|
|||
elif !grab_close&&grabbed:
|
||||
pointer.released(Initiator.EventType.GRIP)
|
||||
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")]
|
||||
visible = false
|
||||
applymiddlefingerfix = null
|
||||
applyscaling = null
|
||||
coincidewristorknuckle = null
|
||||
visiblehandtrackskeleton = false
|
||||
enableautotracker = false
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user