commit
3c2282e2b8
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:065527a0fe822f47a1f45bed61a0dcca10f73004f9c012fb3539021ca6bd2fbd
|
oid sha256:034fb07ad84872c283141a5f2ae34989b349cdf77328cab5458a9263f58e4967
|
||||||
size 2451944
|
size 2984138
|
||||||
|
|
|
@ -12,7 +12,7 @@ func _ready():
|
||||||
sprite.set_frame(1)
|
sprite.set_frame(1)
|
||||||
|
|
||||||
|
|
||||||
func _on_toggle():
|
func _on_click(event):
|
||||||
HomeAdapters.adapter.set_state(entity_id, "off" if sprite.get_frame() == 0 else "on")
|
HomeAdapters.adapter.set_state(entity_id, "off" if sprite.get_frame() == 0 else "on")
|
||||||
if sprite.get_frame() == 0:
|
if sprite.get_frame() == 0:
|
||||||
sprite.set_frame(1)
|
sprite.set_frame(1)
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
[gd_scene load_steps=6 format=3 uid="uid://cw86rc42dv2d8"]
|
[gd_scene load_steps=7 format=3 uid="uid://cw86rc42dv2d8"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://content/entities/light/light.gd" id="1_ykxy3"]
|
[ext_resource type="Script" path="res://content/entities/light/light.gd" id="1_ykxy3"]
|
||||||
[ext_resource type="Texture2D" uid="uid://b72vsbcvqqxg7" path="res://assets/materials/swich_on.png" id="2_6gn2e"]
|
[ext_resource type="Texture2D" uid="uid://b72vsbcvqqxg7" path="res://assets/materials/swich_on.png" id="2_6gn2e"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cvc0o6dsktnvl" path="res://assets/materials/switch_off.png" id="3_qlm62"]
|
[ext_resource type="Texture2D" uid="uid://cvc0o6dsktnvl" path="res://assets/materials/switch_off.png" id="3_qlm62"]
|
||||||
|
[ext_resource type="Script" path="res://content/functions/movable.gd" id="4_4sfxb"]
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_ukj14"]
|
[sub_resource type="SphereShape3D" id="SphereShape3D_ukj14"]
|
||||||
radius = 0.1
|
radius = 0.1
|
||||||
|
@ -31,3 +32,6 @@ shape = SubResource("SphereShape3D_ukj14")
|
||||||
pixel_size = 0.0005
|
pixel_size = 0.0005
|
||||||
billboard = 1
|
billboard = 1
|
||||||
sprite_frames = SubResource("SpriteFrames_ldpuo")
|
sprite_frames = SubResource("SpriteFrames_ldpuo")
|
||||||
|
|
||||||
|
[node name="Movable" type="Node" parent="."]
|
||||||
|
script = ExtResource("4_4sfxb")
|
||||||
|
|
|
@ -12,5 +12,5 @@ func _ready():
|
||||||
label.text = new_state["state"]
|
label.text = new_state["state"]
|
||||||
)
|
)
|
||||||
|
|
||||||
func _on_toggle():
|
func _on_click(event):
|
||||||
pass
|
pass
|
|
@ -1,6 +1,7 @@
|
||||||
[gd_scene load_steps=3 format=3 uid="uid://xsiy71rsqulj"]
|
[gd_scene load_steps=4 format=3 uid="uid://xsiy71rsqulj"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://content/entities/sensor/sensor.gd" id="1_57ac8"]
|
[ext_resource type="Script" path="res://content/entities/sensor/sensor.gd" id="1_57ac8"]
|
||||||
|
[ext_resource type="Script" path="res://content/functions/movable.gd" id="2_fpq5q"]
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_r20gc"]
|
[sub_resource type="SphereShape3D" id="SphereShape3D_r20gc"]
|
||||||
radius = 0.1
|
radius = 0.1
|
||||||
|
@ -13,3 +14,6 @@ shape = SubResource("SphereShape3D_r20gc")
|
||||||
|
|
||||||
[node name="Label" type="Label3D" parent="."]
|
[node name="Label" type="Label3D" parent="."]
|
||||||
text = "some text"
|
text = "some text"
|
||||||
|
|
||||||
|
[node name="Movable" type="Node" parent="."]
|
||||||
|
script = ExtResource("2_fpq5q")
|
||||||
|
|
|
@ -22,7 +22,7 @@ func _ready():
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func _on_toggle():
|
func _on_click(event):
|
||||||
HomeAdapters.adapter.set_state(entity_id, "off" if sprite.get_frame() == 0 else "on")
|
HomeAdapters.adapter.set_state(entity_id, "off" if sprite.get_frame() == 0 else "on")
|
||||||
if sprite.get_frame() == 0:
|
if sprite.get_frame() == 0:
|
||||||
sprite.set_frame(1)
|
sprite.set_frame(1)
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
[gd_scene load_steps=6 format=3 uid="uid://cscl5k7lhopj5"]
|
[gd_scene load_steps=7 format=3 uid="uid://cscl5k7lhopj5"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://content/entities/switch/switch.gd" id="1_8ffhi"]
|
[ext_resource type="Script" path="res://content/entities/switch/switch.gd" id="1_8ffhi"]
|
||||||
[ext_resource type="Texture2D" uid="uid://b72vsbcvqqxg7" path="res://assets/materials/swich_on.png" id="1_w68gw"]
|
[ext_resource type="Texture2D" uid="uid://b72vsbcvqqxg7" path="res://assets/materials/swich_on.png" id="1_w68gw"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cvc0o6dsktnvl" path="res://assets/materials/switch_off.png" id="2_86ba1"]
|
[ext_resource type="Texture2D" uid="uid://cvc0o6dsktnvl" path="res://assets/materials/switch_off.png" id="2_86ba1"]
|
||||||
|
[ext_resource type="Script" path="res://content/functions/movable.gd" id="4_6xr03"]
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_ukj14"]
|
[sub_resource type="SphereShape3D" id="SphereShape3D_ukj14"]
|
||||||
radius = 0.1
|
radius = 0.1
|
||||||
|
@ -31,3 +32,6 @@ shape = SubResource("SphereShape3D_ukj14")
|
||||||
pixel_size = 0.0005
|
pixel_size = 0.0005
|
||||||
billboard = 1
|
billboard = 1
|
||||||
sprite_frames = SubResource("SpriteFrames_ldpuo")
|
sprite_frames = SubResource("SpriteFrames_ldpuo")
|
||||||
|
|
||||||
|
[node name="Movable" type="Node" parent="."]
|
||||||
|
script = ExtResource("4_6xr03")
|
||||||
|
|
2
content/functions/function.gd
Normal file
2
content/functions/function.gd
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
extends Node
|
||||||
|
class_name Function
|
22
content/functions/movable.gd
Normal file
22
content/functions/movable.gd
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
@tool
|
||||||
|
extends Function
|
||||||
|
class_name Movable
|
||||||
|
|
||||||
|
var hit_node := Node3D.new()
|
||||||
|
|
||||||
|
func _on_grab_down(event):
|
||||||
|
event.controller.add_child(hit_node)
|
||||||
|
hit_node.global_position = get_parent().global_position
|
||||||
|
|
||||||
|
func _on_grab_move(event):
|
||||||
|
get_parent().global_position = hit_node.global_position
|
||||||
|
get_parent().global_rotation = hit_node.global_rotation
|
||||||
|
|
||||||
|
func _get_configuration_warnings() -> PackedStringArray:
|
||||||
|
var warnings := PackedStringArray()
|
||||||
|
|
||||||
|
if get_parent() is StaticBody3D == false:
|
||||||
|
warnings.append("Movable requires a StaticBody3D as parent.")
|
||||||
|
|
||||||
|
|
||||||
|
return warnings
|
|
@ -57,7 +57,7 @@ script = ExtResource("1_tsqxc")
|
||||||
ray = NodePath("RayCast3D")
|
ray = NodePath("RayCast3D")
|
||||||
|
|
||||||
[node name="RayCast3D" type="RayCast3D" parent="XROrigin3D/XRControllerRight/Raycast"]
|
[node name="RayCast3D" type="RayCast3D" parent="XROrigin3D/XRControllerRight/Raycast"]
|
||||||
transform = Transform3D(1.91069e-15, 4.37114e-08, 1, 1, -4.37114e-08, 0, 4.37114e-08, 1, -4.37114e-08, 0, 0, 0)
|
transform = Transform3D(-2.58078e-11, 4.3714e-08, 1, 1, -4.37117e-08, 9.27469e-12, 4.37112e-08, 1, -4.3714e-08, 0, 0, 0)
|
||||||
target_position = Vector3(0, -5, 0)
|
target_position = Vector3(0, -5, 0)
|
||||||
|
|
||||||
[node name="StartXR" parent="." instance=ExtResource("1_i4c04")]
|
[node name="StartXR" parent="." instance=ExtResource("1_i4c04")]
|
||||||
|
|
|
@ -25,10 +25,13 @@ func _get_event_data():
|
||||||
}
|
}
|
||||||
|
|
||||||
func _handle_move():
|
func _handle_move():
|
||||||
|
if _is_pressed == false && _is_grabbed == false:
|
||||||
|
return
|
||||||
|
|
||||||
var distance = ray.get_collision_point().distance_to(_click_point)
|
var distance = ray.get_collision_point().distance_to(_click_point)
|
||||||
var collider = ray.get_collider()
|
var collider = ray.get_collider()
|
||||||
|
|
||||||
if distance > 0.01:
|
if distance > 0.02:
|
||||||
if _is_pressed:
|
if _is_pressed:
|
||||||
_call_fn(collider, "_on_press_move")
|
_call_fn(collider, "_on_press_move")
|
||||||
_moved = true
|
_moved = true
|
||||||
|
@ -84,5 +87,10 @@ func _on_button_released(button):
|
||||||
_moved = false
|
_moved = false
|
||||||
|
|
||||||
func _call_fn(collider: Object, fn_name: String):
|
func _call_fn(collider: Object, fn_name: String):
|
||||||
if collider != null && collider.has_method(fn_name):
|
if collider != null:
|
||||||
collider.call(fn_name, _get_event_data())
|
if collider.has_method(fn_name):
|
||||||
|
collider.call(fn_name, _get_event_data())
|
||||||
|
|
||||||
|
for child in collider.get_children():
|
||||||
|
if child is Function:
|
||||||
|
_call_fn(child, fn_name)
|
||||||
|
|
|
@ -5,7 +5,7 @@ extends StaticBody3D
|
||||||
|
|
||||||
signal click(id: String)
|
signal click(id: String)
|
||||||
|
|
||||||
func _on_toggle():
|
func _on_click(event):
|
||||||
click.emit(id)
|
click.emit(id)
|
||||||
|
|
||||||
func set_device_name(text):
|
func set_device_name(text):
|
||||||
|
|
|
@ -5,7 +5,7 @@ extends StaticBody3D
|
||||||
|
|
||||||
signal click(name: String)
|
signal click(name: String)
|
||||||
|
|
||||||
func _on_toggle():
|
func _on_click(event):
|
||||||
click.emit(text)
|
click.emit(text)
|
||||||
|
|
||||||
func set_entity_name(text):
|
func set_entity_name(text):
|
||||||
|
|
|
@ -7,7 +7,7 @@ var request_timeout := 10.0
|
||||||
|
|
||||||
var url := "ws://192.168.33.33:8123/api/websocket"
|
var url := "ws://192.168.33.33:8123/api/websocket"
|
||||||
var token := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIzZjQ0ZGM2N2Y3YzY0MDc1OGZlMWI2ZjJlNmIxZjRkNSIsImlhdCI6MTY5ODAxMDcyOCwiZXhwIjoyMDEzMzcwNzI4fQ.K6ydLUC-4Q7BNIRCU1nWlI2s6sg9UCiOu-Lpedw2zJc"
|
var token := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIzZjQ0ZGM2N2Y3YzY0MDc1OGZlMWI2ZjJlNmIxZjRkNSIsImlhdCI6MTY5ODAxMDcyOCwiZXhwIjoyMDEzMzcwNzI4fQ.K6ydLUC-4Q7BNIRCU1nWlI2s6sg9UCiOu-Lpedw2zJc"
|
||||||
var LOG_MESSAGES := true
|
var LOG_MESSAGES := false
|
||||||
|
|
||||||
var authenticated := false
|
var authenticated := false
|
||||||
var loading := true
|
var loading := true
|
||||||
|
|
Loading…
Reference in New Issue
Block a user