continue on wim
This commit is contained in:
parent
2cb35ef02b
commit
d07a7b924f
|
@ -29,4 +29,4 @@ nodes/OpenHand/node = SubResource("4")
|
||||||
nodes/OpenHand/position = Vector2(-600, 100)
|
nodes/OpenHand/position = Vector2(-600, 100)
|
||||||
nodes/Trigger/node = SubResource("5")
|
nodes/Trigger/node = SubResource("5")
|
||||||
nodes/Trigger/position = Vector2(-360, 20)
|
nodes/Trigger/position = Vector2(-360, 20)
|
||||||
node_connections = [&"output", 0, &"Grip", &"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1"]
|
node_connections = [&"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1", &"output", 0, &"Grip"]
|
||||||
|
|
|
@ -29,4 +29,4 @@ nodes/OpenHand/node = SubResource("3")
|
||||||
nodes/OpenHand/position = Vector2(-600, 100)
|
nodes/OpenHand/position = Vector2(-600, 100)
|
||||||
nodes/Trigger/node = SubResource("5")
|
nodes/Trigger/node = SubResource("5")
|
||||||
nodes/Trigger/position = Vector2(-360, 40)
|
nodes/Trigger/position = Vector2(-360, 40)
|
||||||
node_connections = [&"output", 0, &"Grip", &"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1"]
|
node_connections = [&"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1", &"output", 0, &"Grip"]
|
||||||
|
|
|
@ -6,7 +6,7 @@ const RoomType = preload ("./room/room.gd")
|
||||||
@onready var levels = $Levels
|
@onready var levels = $Levels
|
||||||
@onready var collision_shape = $Levels/CollisionShape3D
|
@onready var collision_shape = $Levels/CollisionShape3D
|
||||||
@onready var align_reference = $AlignReference
|
@onready var align_reference = $AlignReference
|
||||||
@onready var mini_view = $Miniature
|
@onready var mini_view = $Levels/Miniature
|
||||||
|
|
||||||
var fixing_reference: bool = false
|
var fixing_reference: bool = false
|
||||||
var editing_room: RoomType = null
|
var editing_room: RoomType = null
|
||||||
|
@ -23,7 +23,7 @@ func update_house():
|
||||||
|
|
||||||
align_reference.update_align_reference()
|
align_reference.update_align_reference()
|
||||||
|
|
||||||
for index in range(Store.house.state.rooms.size() - 1, -1, -1):
|
for index in range(Store.house.state.rooms.size()):
|
||||||
var new_room = Store.house.state.rooms[index]
|
var new_room = Store.house.state.rooms[index]
|
||||||
|
|
||||||
if new_room.corners.size() == 0:
|
if new_room.corners.size() == 0:
|
||||||
|
|
|
@ -23,8 +23,8 @@ script = ExtResource("2_w1auk")
|
||||||
restricted = true
|
restricted = true
|
||||||
lock_rotation = true
|
lock_rotation = true
|
||||||
|
|
||||||
|
[node name="Miniature" parent="Levels" instance=ExtResource("4_qjbly")]
|
||||||
|
|
||||||
[node name="AlignReference" parent="." instance=ExtResource("3_e1tcn")]
|
[node name="AlignReference" parent="." instance=ExtResource("3_e1tcn")]
|
||||||
visible = false
|
visible = false
|
||||||
disabled = true
|
disabled = true
|
||||||
|
|
||||||
[node name="Miniature" parent="." instance=ExtResource("4_qjbly")]
|
|
||||||
|
|
|
@ -3,63 +3,88 @@ extends Node3D
|
||||||
const ConstructRoomMesh = preload ("res://lib/utils/mesh/construct_room_mesh.gd")
|
const ConstructRoomMesh = preload ("res://lib/utils/mesh/construct_room_mesh.gd")
|
||||||
const wall_material = preload ("./mini_wall.tres")
|
const wall_material = preload ("./mini_wall.tres")
|
||||||
|
|
||||||
|
@onready var body = $Body
|
||||||
|
@onready var model = $Body/Model
|
||||||
@onready var walls_mesh = $Body/Model/WallsMesh
|
@onready var walls_mesh = $Body/Model/WallsMesh
|
||||||
@onready var floor_mesh = $Body/Model/FloorMesh
|
@onready var floor_mesh = $Body/Model/FloorMesh
|
||||||
@onready var collision_shape = $Body/CollisionShape3D
|
@onready var collision_shape = $Body/CollisionShape3D
|
||||||
@onready var toggle_heatmap = $HeatmapButton
|
@onready var toggle_heatmap = $Body/HeatmapButton
|
||||||
|
|
||||||
# var temperature_scale := Vector2( - 20.0, 60.0)
|
# var temperature_scale := Vector2( - 20.0, 60.0)
|
||||||
var temperature_scale := Vector2(22.0, 25.0)
|
var temperature_scale := Vector2(22.0, 26.0)
|
||||||
|
|
||||||
var enabled = true:
|
var heatmap = R.state(false)
|
||||||
set(value):
|
var small = R.state(false)
|
||||||
enabled = value
|
|
||||||
update()
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
update()
|
|
||||||
|
|
||||||
if Store.house.is_loaded() == false:
|
if Store.house.is_loaded() == false:
|
||||||
await Store.house.on_loaded
|
await Store.house.on_loaded
|
||||||
|
|
||||||
if Store.house.state.rooms.size() == 0:
|
R.effect(func(_arg):
|
||||||
return
|
if Store.house.state.rooms.size() == 0:
|
||||||
|
return
|
||||||
|
|
||||||
var room = Store.house.state.rooms[0]
|
if heatmap.value == false:
|
||||||
|
return
|
||||||
|
|
||||||
var corners = room.corners
|
for room in Store.house.state.rooms:
|
||||||
var height = room.height
|
var corners=room.corners
|
||||||
|
var height=room.height
|
||||||
|
|
||||||
walls_mesh.mesh = ConstructRoomMesh.generate_wall_mesh_grid(corners, height)
|
walls_mesh.mesh=ConstructRoomMesh.generate_wall_mesh_grid(corners, height)
|
||||||
floor_mesh.mesh = ConstructRoomMesh.generate_ceiling_mesh_grid(corners)
|
floor_mesh.mesh=ConstructRoomMesh.generate_ceiling_mesh_grid(corners)
|
||||||
|
|
||||||
walls_mesh.material_override = wall_material
|
walls_mesh.material_override=wall_material
|
||||||
floor_mesh.material_override = wall_material
|
floor_mesh.material_override=wall_material
|
||||||
|
|
||||||
active = true
|
|
||||||
EventSystem.on_slow_tick.connect(update_data)
|
|
||||||
|
|
||||||
toggle_heatmap.on_button_down.connect(func():
|
|
||||||
active=true
|
|
||||||
EventSystem.on_slow_tick.connect(update_data)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
toggle_heatmap.on_button_up.connect(func():
|
R.bind(toggle_heatmap, "active", heatmap, toggle_heatmap.on_toggled)
|
||||||
wall_material.set_shader_parameter("data", [])
|
|
||||||
wall_material.set_shader_parameter("data_size", 0)
|
R.effect(func(_arg):
|
||||||
active=false
|
var tween:=create_tween()
|
||||||
EventSystem.on_slow_tick.disconnect(update_data)
|
tween.set_parallel(true)
|
||||||
|
if small.value:
|
||||||
|
|
||||||
|
var aabb=House.body.get_level_aabb(0)
|
||||||
|
aabb.position.y=- 0.03
|
||||||
|
aabb.size.y=0.06
|
||||||
|
|
||||||
|
var center=aabb.position + aabb.size / 2
|
||||||
|
|
||||||
|
collision_shape.shape.size=aabb.size * 0.1
|
||||||
|
|
||||||
|
var camera=$"/root/Main/XROrigin3D/XRCamera3D"
|
||||||
|
var camera_position=camera.global_position
|
||||||
|
var camera_direction=- camera.global_transform.basis.z
|
||||||
|
|
||||||
|
camera_position.y *= 0.5
|
||||||
|
camera_direction.y=0
|
||||||
|
|
||||||
|
var target_position=camera_position + camera_direction.normalized() * 0.2
|
||||||
|
var new_position=target_position - center * 0.1
|
||||||
|
|
||||||
|
tween.tween_property(model, "scale", Vector3(0.1, 0.1, 0.1), 0.5)
|
||||||
|
tween.tween_property(body, "position", new_position, 0.5)
|
||||||
|
else:
|
||||||
|
tween.tween_property(model, "scale", Vector3(1, 1, 1), 0.5)
|
||||||
|
tween.tween_property(body, "position", Vector3(0, 0, 0), 0.5)
|
||||||
)
|
)
|
||||||
|
|
||||||
func update():
|
R.effect(func(_arg):
|
||||||
walls_mesh.visible = enabled
|
walls_mesh.visible=heatmap.value
|
||||||
floor_mesh.visible = enabled
|
floor_mesh.visible=heatmap.value
|
||||||
collision_shape.disabled = not enabled
|
collision_shape.disabled=!heatmap.value
|
||||||
|
|
||||||
|
if heatmap.value:
|
||||||
|
EventSystem.on_slow_tick.connect(update_data)
|
||||||
|
else:
|
||||||
|
EventSystem.on_slow_tick.disconnect(update_data)
|
||||||
|
wall_material.set_shader_parameter("data", [])
|
||||||
|
wall_material.set_shader_parameter("data_size", 0)
|
||||||
|
)
|
||||||
|
|
||||||
const SensorEntity = preload ("res://content/entities/sensor/sensor.gd")
|
const SensorEntity = preload ("res://content/entities/sensor/sensor.gd")
|
||||||
|
|
||||||
var active: bool = false
|
|
||||||
|
|
||||||
func update_data(_delta: float) -> void:
|
func update_data(_delta: float) -> void:
|
||||||
var data_list = []
|
var data_list = []
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,6 @@
|
||||||
[node name="Miniature" type="Node3D"]
|
[node name="Miniature" type="Node3D"]
|
||||||
script = ExtResource("1_b53yn")
|
script = ExtResource("1_b53yn")
|
||||||
|
|
||||||
[node name="HeatmapButton" parent="." instance=ExtResource("3_tgdcf")]
|
|
||||||
toggleable = true
|
|
||||||
|
|
||||||
[node name="Body" type="StaticBody3D" parent="."]
|
[node name="Body" type="StaticBody3D" parent="."]
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body"]
|
||||||
|
@ -27,3 +24,8 @@ skeleton = NodePath("../../..")
|
||||||
|
|
||||||
[node name="FloorMesh" type="MeshInstance3D" parent="Body/Model"]
|
[node name="FloorMesh" type="MeshInstance3D" parent="Body/Model"]
|
||||||
skeleton = NodePath("../../..")
|
skeleton = NodePath("../../..")
|
||||||
|
|
||||||
|
[node name="HeatmapButton" parent="Body" instance=ExtResource("3_tgdcf")]
|
||||||
|
label = "heat"
|
||||||
|
icon = true
|
||||||
|
toggleable = true
|
||||||
|
|
|
@ -5,6 +5,7 @@ class_name Button3D
|
||||||
|
|
||||||
signal on_button_down()
|
signal on_button_down()
|
||||||
signal on_button_up()
|
signal on_button_up()
|
||||||
|
signal on_toggled(active: bool)
|
||||||
|
|
||||||
const IconFont = preload ("res://assets/icons/icons.tres")
|
const IconFont = preload ("res://assets/icons/icons.tres")
|
||||||
const ECHO_WAIT_INITIAL = 0.5
|
const ECHO_WAIT_INITIAL = 0.5
|
||||||
|
@ -57,6 +58,8 @@ const ECHO_WAIT_REPEAT = 0.1
|
||||||
|
|
||||||
var active: bool = false:
|
var active: bool = false:
|
||||||
set(value):
|
set(value):
|
||||||
|
if active != value:
|
||||||
|
on_toggled.emit(value)
|
||||||
active = value
|
active = value
|
||||||
if !is_inside_tree(): return
|
if !is_inside_tree(): return
|
||||||
update_animation(1.0 if active else 0.0)
|
update_animation(1.0 if active else 0.0)
|
||||||
|
|
|
@ -7,5 +7,5 @@ func _ready():
|
||||||
background.visible = false
|
background.visible = false
|
||||||
|
|
||||||
mini_view.on_button_down.connect(func():
|
mini_view.on_button_down.connect(func():
|
||||||
House.body.mini_view.enabled=!House.body.mini_view.enabled
|
House.body.mini_view.small.value=!House.body.mini_view.small.value
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user