fixes to hands and buttons
This commit is contained in:
parent
1a47406e9f
commit
8bf3c5ce3d
|
@ -16,7 +16,6 @@ const Entity = preload("../entity.gd")
|
||||||
var playing = false
|
var playing = false
|
||||||
var volume = 50
|
var volume = 50
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
super()
|
super()
|
||||||
|
@ -45,12 +44,14 @@ func _ready():
|
||||||
|
|
||||||
slider.on_value_changed.connect(set_volume)
|
slider.on_value_changed.connect(set_volume)
|
||||||
|
|
||||||
|
|
||||||
func set_volume(value):
|
func set_volume(value):
|
||||||
volume = value
|
volume = value
|
||||||
HomeApi.set_state(entity_id, "volume", {"volume_level": value / 100})
|
HomeApi.set_state(entity_id, "volume", {"volume_level": value / 100})
|
||||||
|
|
||||||
func set_state(stateInfo):
|
func set_state(stateInfo):
|
||||||
|
if stateInfo == null:
|
||||||
|
return
|
||||||
|
|
||||||
var state = stateInfo["state"]
|
var state = stateInfo["state"]
|
||||||
|
|
||||||
if state == "playing":
|
if state == "playing":
|
||||||
|
|
|
@ -53,7 +53,7 @@ transform = Transform3D(1, -7.45058e-09, -2.22045e-16, 7.45058e-09, 1, 0, 0, 0,
|
||||||
shape = SubResource("CapsuleShape3D_dopke")
|
shape = SubResource("CapsuleShape3D_dopke")
|
||||||
|
|
||||||
[node name="ThumbTip" type="BoneAttachment3D" parent="XRHandLeft"]
|
[node name="ThumbTip" type="BoneAttachment3D" parent="XRHandLeft"]
|
||||||
transform = Transform3D(0.937246, 0.0284254, -0.347508, 0.0184905, 0.991216, 0.130949, 0.348178, -0.129157, 0.928488, 0.0498668, 0.0560917, -0.112777)
|
transform = Transform3D(0.937246, 0.0284254, -0.347508, 0.0184905, 0.991216, 0.130949, 0.348178, -0.129157, 0.928487, 0.0498668, 0.0560917, -0.112777)
|
||||||
bone_name = "Thumb_Tip_L"
|
bone_name = "Thumb_Tip_L"
|
||||||
bone_idx = 4
|
bone_idx = 4
|
||||||
use_external_skeleton = true
|
use_external_skeleton = true
|
||||||
|
@ -63,7 +63,7 @@ external_skeleton = NodePath("../left_hand/Armature_001/Skeleton3D")
|
||||||
gizmo_extents = 0.02
|
gizmo_extents = 0.02
|
||||||
|
|
||||||
[node name="MiddleTip" type="BoneAttachment3D" parent="XRHandLeft"]
|
[node name="MiddleTip" type="BoneAttachment3D" parent="XRHandLeft"]
|
||||||
transform = Transform3D(0.0812012, -0.650531, -0.755125, 0.996577, 0.064817, 0.051326, 0.0155558, -0.756708, 0.653568, 0.032112, 0.00654224, -0.171612)
|
transform = Transform3D(0.0812012, -0.650531, -0.755125, 0.996576, 0.064817, 0.051326, 0.0155558, -0.756708, 0.653567, 0.032112, 0.00654224, -0.171612)
|
||||||
bone_name = "Middle_Tip_L"
|
bone_name = "Middle_Tip_L"
|
||||||
bone_idx = 14
|
bone_idx = 14
|
||||||
use_external_skeleton = true
|
use_external_skeleton = true
|
||||||
|
@ -106,7 +106,7 @@ transform = Transform3D(1, 0, 4.7579e-13, 0, 1, 0, -1.34149e-12, 1.77636e-15, 1,
|
||||||
material_override = SubResource("StandardMaterial3D_n27ki")
|
material_override = SubResource("StandardMaterial3D_n27ki")
|
||||||
|
|
||||||
[node name="IndexTip" type="BoneAttachment3D" parent="XRHandRight"]
|
[node name="IndexTip" type="BoneAttachment3D" parent="XRHandRight"]
|
||||||
transform = Transform3D(0.19221, 0.669966, 0.717079, -0.091543, -0.715277, 0.69282, 0.977075, -0.19881, -0.0761527, -0.0345977, -0.164767, -0.0355401)
|
transform = Transform3D(0.19221, 0.669966, 0.717078, -0.091543, -0.715277, 0.69282, 0.977075, -0.19881, -0.0761527, -0.0345978, -0.164767, -0.0355401)
|
||||||
bone_name = "Index_Tip_R"
|
bone_name = "Index_Tip_R"
|
||||||
bone_idx = 9
|
bone_idx = 9
|
||||||
use_external_skeleton = true
|
use_external_skeleton = true
|
||||||
|
@ -136,7 +136,7 @@ external_skeleton = NodePath("../right_hand/Armature/Skeleton3D")
|
||||||
gizmo_extents = 0.02
|
gizmo_extents = 0.02
|
||||||
|
|
||||||
[node name="MiddleTip" type="BoneAttachment3D" parent="XRHandRight"]
|
[node name="MiddleTip" type="BoneAttachment3D" parent="XRHandRight"]
|
||||||
transform = Transform3D(0.0812011, 0.650531, 0.755126, -0.0155557, -0.756709, 0.653568, 0.996576, -0.0648169, -0.0513262, -0.032112, -0.171612, -0.00654216)
|
transform = Transform3D(0.0812011, 0.650531, 0.755126, -0.0155557, -0.756708, 0.653568, 0.996576, -0.0648169, -0.0513262, -0.032112, -0.171612, -0.00654216)
|
||||||
bone_name = "Middle_Tip_R"
|
bone_name = "Middle_Tip_R"
|
||||||
bone_idx = 14
|
bone_idx = 14
|
||||||
use_external_skeleton = true
|
use_external_skeleton = true
|
||||||
|
|
|
@ -4,6 +4,9 @@ class_name TouchBody3D
|
||||||
@export var plane = Plane.PLANE_XZ
|
@export var plane = Plane.PLANE_XZ
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
|
set_collision_layer_value(1, false)
|
||||||
|
set_collision_layer_value(3, true)
|
||||||
|
|
||||||
var collisionShape = null
|
var collisionShape = null
|
||||||
|
|
||||||
for child in get_children():
|
for child in get_children():
|
||||||
|
|
|
@ -2,7 +2,6 @@ extends RoomState
|
||||||
|
|
||||||
const RoomState = preload ("./room_state.gd")
|
const RoomState = preload ("./room_state.gd")
|
||||||
|
|
||||||
|
|
||||||
func _on_enter():
|
func _on_enter():
|
||||||
var room_store = Store.house.get_room(room.name)
|
var room_store = Store.house.get_room(room.name)
|
||||||
|
|
||||||
|
@ -17,6 +16,8 @@ func _on_enter():
|
||||||
if room.wall_mesh.mesh == null:
|
if room.wall_mesh.mesh == null:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
room.room_ceiling.position.y = room_store.height
|
||||||
|
|
||||||
var ceiling_shape = room.room_ceiling.get_node("CollisionShape3D")
|
var ceiling_shape = room.room_ceiling.get_node("CollisionShape3D")
|
||||||
var floor_shape = room.room_floor.get_node("CollisionShape3D")
|
var floor_shape = room.room_floor.get_node("CollisionShape3D")
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,7 @@ var active: bool = false:
|
||||||
update_animation()
|
update_animation()
|
||||||
|
|
||||||
@onready var animation_player: AnimationPlayer = $AnimationPlayer
|
@onready var animation_player: AnimationPlayer = $AnimationPlayer
|
||||||
|
@onready var console = get_node("/root/Main/Console")
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
if initial_active:
|
if initial_active:
|
||||||
|
@ -116,6 +117,9 @@ func _on_press_up(event):
|
||||||
on_button_up.emit()
|
on_button_up.emit()
|
||||||
|
|
||||||
func _on_touch_enter(event: EventTouch):
|
func _on_touch_enter(event: EventTouch):
|
||||||
|
if event.target != finger_area:
|
||||||
|
return
|
||||||
|
|
||||||
animation_player.stop()
|
animation_player.stop()
|
||||||
animation_player.speed_scale = 0
|
animation_player.speed_scale = 0
|
||||||
animation_player.current_animation = "down"
|
animation_player.current_animation = "down"
|
||||||
|
@ -136,7 +140,6 @@ func _on_touch_leave(_event: EventTouch):
|
||||||
else:
|
else:
|
||||||
on_button_down.emit()
|
on_button_down.emit()
|
||||||
|
|
||||||
|
|
||||||
func _touch_change(event: EventTouch):
|
func _touch_change(event: EventTouch):
|
||||||
if disabled:
|
if disabled:
|
||||||
event.bubbling = false
|
event.bubbling = false
|
||||||
|
@ -148,8 +151,8 @@ func _touch_change(event: EventTouch):
|
||||||
if pos.y > finger_pos.y:
|
if pos.y > finger_pos.y:
|
||||||
pos = finger_pos
|
pos = finger_pos
|
||||||
|
|
||||||
var button_height = finger_area.get_node("CollisionShape3D").shape.size.y
|
var button_height = 0.2
|
||||||
var button_center = finger_area.position.y
|
var button_center = 0.1
|
||||||
|
|
||||||
var percent = clamp((button_center + button_height / 2 - pos.y) / (button_height / 2), 0, 1)
|
var percent = clamp((button_center + button_height / 2 - pos.y) / (button_height / 2), 0, 1)
|
||||||
|
|
||||||
|
@ -164,4 +167,3 @@ func _touch_change(event: EventTouch):
|
||||||
return
|
return
|
||||||
|
|
||||||
active = percent < 1
|
active = percent < 1
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
[gd_scene load_steps=9 format=3 uid="uid://bsjqdvkt0u87c"]
|
[gd_scene load_steps=11 format=3 uid="uid://bsjqdvkt0u87c"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://content/ui/components/button/button.gd" id="1_74x7g"]
|
[ext_resource type="Script" path="res://content/ui/components/button/button.gd" id="1_74x7g"]
|
||||||
[ext_resource type="ArrayMesh" uid="uid://iv4lk77axlk4" path="res://assets/immersive_home/button.obj" id="2_cve3l"]
|
[ext_resource type="ArrayMesh" uid="uid://iv4lk77axlk4" path="res://assets/immersive_home/button.obj" id="2_cve3l"]
|
||||||
[ext_resource type="Material" uid="uid://bujy3egn1oqac" path="res://assets/materials/pri-500.material" id="2_wx7av"]
|
[ext_resource type="Material" uid="uid://bujy3egn1oqac" path="res://assets/materials/pri-500.material" id="2_wx7av"]
|
||||||
|
[ext_resource type="Script" path="res://content/system/hands/touch_area.gd" id="4_b27lx"]
|
||||||
|
|
||||||
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_o4j7g"]
|
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_o4j7g"]
|
||||||
points = PackedVector3Array(-0.025, -0.01, -0.025, -0.025, 0.01, -0.025, 0.025, -0.01, -0.025, -0.025, -0.01, 0.025, -0.025, 0.01, 0.025, 0.025, 0.01, -0.025, 0.025, -0.01, 0.025, 0.025, 0.01, 0.025)
|
points = PackedVector3Array(-0.025, -0.01, -0.025, -0.025, 0.01, -0.025, 0.025, -0.01, -0.025, -0.025, -0.01, 0.025, -0.025, 0.01, 0.025, 0.025, 0.01, -0.025, 0.025, -0.01, 0.025, 0.025, 0.01, 0.025)
|
||||||
|
@ -66,7 +67,10 @@ _data = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_bqjii"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_bqjii"]
|
||||||
size = Vector3(0.0501598, 0.0195937, 0.0501598)
|
size = Vector3(0.0501598, 0.0390937, 0.0501598)
|
||||||
|
|
||||||
|
[sub_resource type="BoxShape3D" id="BoxShape3D_dfbn3"]
|
||||||
|
size = Vector3(0.05, 0.029126, 0.05)
|
||||||
|
|
||||||
[node name="Button" type="Node3D" groups=["ui_focus"]]
|
[node name="Button" type="Node3D" groups=["ui_focus"]]
|
||||||
script = ExtResource("1_74x7g")
|
script = ExtResource("1_74x7g")
|
||||||
|
@ -107,4 +111,12 @@ collision_mask = 0
|
||||||
monitoring = false
|
monitoring = false
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="FingerArea"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="FingerArea"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.00975001, 0)
|
||||||
shape = SubResource("BoxShape3D_bqjii")
|
shape = SubResource("BoxShape3D_bqjii")
|
||||||
|
|
||||||
|
[node name="TouchBody3D" type="Area3D" parent="."]
|
||||||
|
script = ExtResource("4_b27lx")
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="TouchBody3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.00453955, 0)
|
||||||
|
shape = SubResource("BoxShape3D_dfbn3")
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://c6r4higceibif" path="res://content/ui/menu/settings/settings_menu.tscn" id="11_7wm6b"]
|
[ext_resource type="PackedScene" uid="uid://c6r4higceibif" path="res://content/ui/menu/settings/settings_menu.tscn" id="11_7wm6b"]
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_fgcdq"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_fgcdq"]
|
||||||
size = Vector3(1, 0.51, 1)
|
size = Vector3(0.38, 0.0634595, 0.32)
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_e1esh"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_e1esh"]
|
||||||
size = Vector3(0.38, 0.01, 0.32)
|
size = Vector3(0.38, 0.0128076, 0.32)
|
||||||
|
|
||||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ti5t2"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ti5t2"]
|
||||||
|
|
||||||
|
@ -169,16 +169,16 @@ _data = {
|
||||||
script = ExtResource("1_ng4u3")
|
script = ExtResource("1_ng4u3")
|
||||||
|
|
||||||
[node name="TouchBody3D" type="Area3D" parent="."]
|
[node name="TouchBody3D" type="Area3D" parent="."]
|
||||||
collision_layer = 13311
|
collision_layer = 4
|
||||||
collision_mask = 0
|
collision_mask = 0
|
||||||
script = ExtResource("2_fxtnc")
|
script = ExtResource("2_fxtnc")
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="TouchBody3D"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="TouchBody3D"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.245, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.02, -0.0282703, 2.98023e-08)
|
||||||
shape = SubResource("BoxShape3D_fgcdq")
|
shape = SubResource("BoxShape3D_fgcdq")
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.02, -0.00426685, 1.49012e-08)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.02, -0.00286309, 1.49012e-08)
|
||||||
shape = SubResource("BoxShape3D_e1esh")
|
shape = SubResource("BoxShape3D_e1esh")
|
||||||
|
|
||||||
[node name="Movable" type="Node" parent="."]
|
[node name="Movable" type="Node" parent="."]
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
extends Node3D
|
extends Node3D
|
||||||
|
|
||||||
const ball_scene = preload("./ball.tscn")
|
|
||||||
const credits_scene = preload ("./credits.tscn")
|
const credits_scene = preload ("./credits.tscn")
|
||||||
|
|
||||||
@onready var ball_button = $Content/Button
|
|
||||||
@onready var connection_status = $Content/ConnectionStatus
|
@onready var connection_status = $Content/ConnectionStatus
|
||||||
|
|
||||||
@onready var input_url = $Content/InputURL
|
@onready var input_url = $Content/InputURL
|
||||||
|
@ -17,15 +15,6 @@ const credits_scene = preload("./credits.tscn")
|
||||||
func _ready():
|
func _ready():
|
||||||
background.visible = false
|
background.visible = false
|
||||||
|
|
||||||
ball_button.on_button_down.connect(func():
|
|
||||||
var ball = ball_scene.instantiate()
|
|
||||||
var controller = XRHelpers.get_right_controller(self)
|
|
||||||
|
|
||||||
ball.transform = controller.transform
|
|
||||||
ball.linear_velocity = -controller.transform.basis.z * 5 + Vector3(0, 5, 0)
|
|
||||||
get_tree().root.add_child(ball)
|
|
||||||
)
|
|
||||||
|
|
||||||
credits.on_click.connect(func(_event):
|
credits.on_click.connect(func(_event):
|
||||||
var credits_instance=credits_scene.instantiate()
|
var credits_instance=credits_scene.instantiate()
|
||||||
get_tree().root.add_child(credits_instance)
|
get_tree().root.add_child(credits_instance)
|
||||||
|
@ -71,4 +60,3 @@ func _ready():
|
||||||
HomeApi.on_disconnect.connect(func():
|
HomeApi.on_disconnect.connect(func():
|
||||||
connection_status.text="Disconnected"
|
connection_status.text="Disconnected"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -22,21 +22,6 @@ mesh = SubResource("BoxMesh_e51x8")
|
||||||
[node name="Content" type="Node3D" parent="."]
|
[node name="Content" type="Node3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.007, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.007, 0)
|
||||||
|
|
||||||
[node name="Label3D" type="Label3D" parent="Content"]
|
|
||||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.124377, 0, 0.263575)
|
|
||||||
pixel_size = 0.001
|
|
||||||
text = "Spawn Ball"
|
|
||||||
font_size = 18
|
|
||||||
outline_size = 0
|
|
||||||
|
|
||||||
[node name="Button" parent="Content" instance=ExtResource("1_faxng")]
|
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0358097, 0, 0.263575)
|
|
||||||
label = "sports_basketball"
|
|
||||||
icon = true
|
|
||||||
|
|
||||||
[node name="Clickable" type="Node" parent="Content/Button"]
|
|
||||||
script = ExtResource("3_qmg6q")
|
|
||||||
|
|
||||||
[node name="ConnectionStatus" type="Label3D" parent="Content"]
|
[node name="ConnectionStatus" type="Label3D" parent="Content"]
|
||||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.250698, 0, 0.151303)
|
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.250698, 0, 0.151303)
|
||||||
pixel_size = 0.001
|
pixel_size = 0.001
|
||||||
|
|
|
@ -10,8 +10,6 @@ var bodies_entered = {}
|
||||||
var hand_left: Node3D
|
var hand_left: Node3D
|
||||||
var hand_right: Node3D
|
var hand_right: Node3D
|
||||||
|
|
||||||
@onready var console = get_node("/root/Main/Console")
|
|
||||||
|
|
||||||
func _init(hand_left: OpenXRHand, hand_right: OpenXRHand, finger_areas: Dictionary):
|
func _init(hand_left: OpenXRHand, hand_right: OpenXRHand, finger_areas: Dictionary):
|
||||||
self.finger_areas = finger_areas
|
self.finger_areas = finger_areas
|
||||||
self.hand_left = hand_left.get_node("left_hand/Armature_001/Skeleton3D/vr_glove_left_slim")
|
self.hand_left = hand_left.get_node("left_hand/Armature_001/Skeleton3D/vr_glove_left_slim")
|
||||||
|
@ -39,13 +37,13 @@ func _physics_process(_delta):
|
||||||
|
|
||||||
for finger in fingers:
|
for finger in fingers:
|
||||||
if finger == Finger.Type.INDEX_LEFT:
|
if finger == Finger.Type.INDEX_LEFT:
|
||||||
var start_pos = finger_areas[finger].global_position
|
var start_pos = finger_areas[finger].get_parent().global_position
|
||||||
var end_pos = body.to_global(body.plane.project(body.to_local(start_pos)))
|
var end_pos = body.to_global(body.plane.project(body.to_local(start_pos)))
|
||||||
|
|
||||||
hand_left.global_position = end_pos + (hand_left.global_position - start_pos)
|
hand_left.global_position = end_pos + (hand_left.global_position - start_pos)
|
||||||
|
|
||||||
elif finger == Finger.Type.INDEX_RIGHT:
|
elif finger == Finger.Type.INDEX_RIGHT:
|
||||||
var start_pos = finger_areas[finger].global_position
|
var start_pos = finger_areas[finger].get_parent().global_position
|
||||||
var end_pos = body.to_global(body.plane.project(body.to_local(start_pos)))
|
var end_pos = body.to_global(body.plane.project(body.to_local(start_pos)))
|
||||||
|
|
||||||
hand_right.global_position = end_pos + (hand_right.global_position - start_pos)
|
hand_right.global_position = end_pos + (hand_right.global_position - start_pos)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user