camera settings

This commit is contained in:
Nitwel 2024-05-27 12:35:43 +02:00
parent 510e9b0c46
commit 8fa356d5b5
3 changed files with 15 additions and 6 deletions

View File

@ -8,6 +8,7 @@ const Entity = preload ("../entity.gd")
@onready var http_request = $HTTPRequest @onready var http_request = $HTTPRequest
@onready var mesh = $MeshInstance3D @onready var mesh = $MeshInstance3D
@onready var refresh_timer = $RefreshTimer @onready var refresh_timer = $RefreshTimer
@onready var settings = $Settings
var cam_active = R.state(false) var cam_active = R.state(false)
var cam_fps = R.state(10) var cam_fps = R.state(10)
@ -20,6 +21,17 @@ func _ready():
refresh_timer.wait_time=1.0 / cam_fps.value refresh_timer.wait_time=1.0 / cam_fps.value
) )
remove_child(settings)
R.effect(func(_arg):
if show_settings.value:
add_child(settings)
elif settings.is_inside_tree():
remove_child(settings)
camera_follower.reset()
App.house.save_all_entities()
)
R.effect(func(_arg): R.effect(func(_arg):
if cam_active.value: if cam_active.value:
refresh_timer.start() refresh_timer.start()

View File

@ -29,8 +29,9 @@ shape = SubResource("BoxShape3D_te0pn")
script = ExtResource("2_e2u6o") script = ExtResource("2_e2u6o")
resizable = true resizable = true
[node name="CameraFollower" type="Node" parent="."] [node name="CameraFollower" type="Node" parent="." node_paths=PackedStringArray("focus_point")]
script = ExtResource("3_j7lrc") script = ExtResource("3_j7lrc")
focus_point = NodePath("../Settings")
[node name="RefreshTimer" type="Timer" parent="."] [node name="RefreshTimer" type="Timer" parent="."]
wait_time = 0.1 wait_time = 0.1

View File

@ -27,7 +27,7 @@ resizable = true
[node name="CameraFollower" type="Node" parent="." node_paths=PackedStringArray("focus_point")] [node name="CameraFollower" type="Node" parent="." node_paths=PackedStringArray("focus_point")]
script = ExtResource("9_a7u7m") script = ExtResource("9_a7u7m")
enabled = false enabled = false
focus_point = NodePath("../FocusPoint") focus_point = NodePath("../Settings")
[node name="Lightbulb" type="CSGCombiner3D" parent="."] [node name="Lightbulb" type="CSGCombiner3D" parent="."]
transform = Transform3D(1, 9.69949e-05, 0.000589194, -9.77749e-05, 0.999999, 0.00135802, -0.000589065, -0.00135808, 0.999999, 0, 0, 0) transform = Transform3D(1, 9.69949e-05, 0.000589194, -9.77749e-05, 0.999999, 0.00135802, -0.000589065, -0.00135808, 0.999999, 0, 0, 0)
@ -78,9 +78,5 @@ horizontal_alignment = 0
stream = ExtResource("8_3togy") stream = ExtResource("8_3togy")
volume_db = -20.0 volume_db = -20.0
[node name="FocusPoint" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.29, 0, 0)
gizmo_extents = 0.1
[node name="Settings" parent="." instance=ExtResource("10_su84f")] [node name="Settings" parent="." instance=ExtResource("10_su84f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.29, 0, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.29, 0, 0)