Merge pull request #133 from Nitwel/improvements

Allow for resizing of the Mini View
This commit is contained in:
Nitwel 2024-04-30 19:27:54 +02:00 committed by GitHub
commit fc18605467
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 415 additions and 177 deletions

1
app/.gitignore vendored
View File

@ -1,6 +1,7 @@
# Godot 4+ specific ignores
.godot/
android/build/
!android/build/AndroidManifest.xml
builds/
reference/

View File

@ -1,2 +1,2 @@
extends Node
class_name Function
class_name Function

View File

@ -6,11 +6,30 @@ signal on_move(position: Vector3, rotation: Vector3)
signal on_moved()
@export var restricted: bool = false
@export var restrict_movement: Callable
@export var resizable: bool = false
@export var lock_rotation: bool = false
@export var restrict_movement: Callable
@export var disabled: bool = false
var hit_node := Node3D.new()
var initiator = null
var initiator2 = null
var resizing = false
var relative_transform = Transform3D()
var initial_point = Vector3()
var initial_rotation = Vector3()
# For Scaling
var initial_position = Vector3()
var initial_direction = Vector3()
var initial_up = Vector3()
var initial_transform = Transform3D()
var distances = Vector2()
func _process(delta):
if get_tree().debug_collisions_hint&&resizing:
DebugDraw3D.draw_line(initial_position, initial_position + initial_direction, Color(1, 0, 0))
DebugDraw3D.draw_line(initial_position, initial_position + initial_up, Color(0, 1, 0))
func _on_grab_down(event: EventPointer):
if disabled:
@ -19,42 +38,87 @@ func _on_grab_down(event: EventPointer):
if restricted&&event.target != get_parent():
return
if resizing&&initiator2 != null:
return
if resizable&&initiator != null:
initiator2 = event.initiator
resizing = true
distances.y = event.ray.get_collision_point().distance_to(event.ray.global_position)
initial_position = _get_first_ray_point()
initial_direction = _get_second_ray_point() - initial_position
initial_up = -initiator.node.global_transform.basis.z.normalized() * distances.x
initial_transform = get_parent().global_transform
return
if resizable:
distances.x = event.ray.get_collision_point().distance_to(event.ray.global_position)
initiator = event.initiator
if hit_node.get_parent() != null:
hit_node.get_parent().remove_child(hit_node)
_update_relative_transform()
initiator.node.add_child(hit_node)
hit_node.global_transform = get_parent().global_transform
if lock_rotation:
initial_point = get_parent().to_local(event.ray.get_collision_point())
initial_rotation = get_parent().global_rotation
func _on_grab_move(event: EventPointer):
if hit_node.get_parent() == null:
return
if event.initiator != initiator:
return
if restrict_movement:
get_parent().global_position = restrict_movement.call(hit_node.global_position)
else:
get_parent().global_position = hit_node.global_position
if !lock_rotation:
get_parent().global_basis = hit_node.global_basis
on_move.emit(get_parent().global_position, get_parent().global_rotation)
else:
on_move.emit(get_parent().global_position, Vector3(0, 0, 0))
if resizing:
var new_position = _get_first_ray_point()
var new_direction = _get_second_ray_point() - new_position
var new_up = -initiator.node.global_transform.basis.z.normalized() * distances.x
if get_tree().debug_collisions_hint:
DebugDraw3D.draw_line(new_position, new_position + new_direction, Color(1, 0, 0))
DebugDraw3D.draw_line(new_position, new_position + new_up, Color(0, 1, 0))
get_parent().global_transform = TransformTools.calc_delta_transform(initial_position, initial_direction, initial_up, new_position, new_direction, new_up) * initial_transform
return
get_parent().global_transform = initiator.node.global_transform * relative_transform
if lock_rotation:
get_parent().global_transform = TransformTools.rotate_around_point(get_parent().global_transform, get_parent().to_global(initial_point), initial_rotation - get_parent().global_rotation)
func _on_grab_up(event: EventPointer):
if event.initiator != initiator:
if event.initiator == initiator2:
initiator2 = null
resizing = false
_update_relative_transform()
return
if hit_node.get_parent() == null:
return
if event.initiator == initiator:
if initiator2 != null:
initiator = initiator2
initiator2 = null
resizing = false
_update_relative_transform()
else:
initiator = null
initiator2 = null
resizing = false
on_moved.emit()
initiator = null
hit_node.get_parent().remove_child(hit_node)
on_moved.emit()
func _get_first_ray_point():
if initiator == null:
return Vector3()
return initiator.node.global_position - initiator.node.global_transform.basis.z.normalized() * distances.x
func _get_second_ray_point():
if initiator2 == null:
return Vector3()
return initiator2.node.global_position - initiator2.node.global_transform.basis.z.normalized() * distances.y
func _update_relative_transform():
relative_transform = initiator.node.global_transform.affine_inverse() * get_parent().global_transform
func _get_configuration_warnings() -> PackedStringArray:
var warnings := PackedStringArray()

View File

@ -31,6 +31,9 @@ environment = ExtResource("2_lsndp")
transform = Transform3D(1, -2.51787e-05, 0.000567105, -0.000567105, 4.3985e-08, 1, -2.51784e-05, -1, 2.97105e-08, -4.65661e-10, 7.21041, 2.06458)
shadow_enabled = true
[node name="StartXR" parent="." instance=ExtResource("1_i4c04")]
enable_passthrough = true
[node name="XROrigin3D" type="XROrigin3D" parent="."]
[node name="XRCamera3D" parent="XROrigin3D" instance=ExtResource("3_rj4ac")]
@ -53,9 +56,6 @@ transform = Transform3D(0.999968, -1.39576e-11, 0, 9.52038e-12, 0.999984, -2.592
ray_left = NodePath("../XRControllerLeft/Raycast")
ray_right = NodePath("../XRControllerRight/Raycast")
[node name="StartXR" parent="." instance=ExtResource("1_i4c04")]
enable_passthrough = true
[node name="XRSimulator" parent="." instance=ExtResource("5_3qc8g")]
min_camera_height = 0.01
xr_origin = NodePath("../XROrigin3D")

View File

@ -25,7 +25,6 @@ var left_pointer: Pointer
var right_pointer: Pointer
var press_distance = 0.03
var grip_distance = 0.03
var close_distance = 0.1
var pressed_left = false
var pressed_right = false
@ -99,55 +98,34 @@ func _process_hand(hand: OpenXRHand):
var distance_trigger = index_tip.global_position.distance_to(thumb_tip.global_position)
var distance_grab = middle_tip.global_position.distance_to(thumb_tip.global_position)
var distance_target = _ray.get_collision_point().distance_to(_ray.global_position)
var trigger_close = distance_trigger <= press_distance
var grab_close = distance_grab <= grip_distance
var distance_close = distance_target <= close_distance
if hand == hand_left:
if !distance_close:
if trigger_close&&!pressed_left:
initiator.on_press.emit(Initiator.EventType.TRIGGER)
pressed_left = true
elif !trigger_close&&pressed_left:
initiator.on_release.emit(Initiator.EventType.TRIGGER)
pressed_left = false
if grab_close&&!grabbed_left:
initiator.on_press.emit(Initiator.EventType.GRIP)
grabbed_left = true
elif !grab_close&&grabbed_left:
initiator.on_release.emit(Initiator.EventType.GRIP)
grabbed_left = false
else:
if trigger_close&&!grabbed_left:
initiator.on_press.emit(Initiator.EventType.GRIP)
grabbed_left = true
elif !trigger_close&&grabbed_left:
initiator.on_release.emit(Initiator.EventType.GRIP)
grabbed_left = false
if trigger_close&&!pressed_left:
initiator.on_press.emit(Initiator.EventType.TRIGGER)
pressed_left = true
elif !trigger_close&&pressed_left:
initiator.on_release.emit(Initiator.EventType.TRIGGER)
pressed_left = false
if grab_close&&!grabbed_left:
initiator.on_press.emit(Initiator.EventType.GRIP)
grabbed_left = true
elif !grab_close&&grabbed_left:
initiator.on_release.emit(Initiator.EventType.GRIP)
grabbed_left = false
else:
if !distance_close:
if trigger_close&&!pressed_right:
initiator.on_press.emit(Initiator.EventType.TRIGGER)
pressed_right = true
elif !trigger_close&&pressed_right:
initiator.on_release.emit(Initiator.EventType.TRIGGER)
pressed_right = false
if trigger_close&&!pressed_right:
initiator.on_press.emit(Initiator.EventType.TRIGGER)
pressed_right = true
elif !trigger_close&&pressed_right:
initiator.on_release.emit(Initiator.EventType.TRIGGER)
pressed_right = false
if grab_close&&!grabbed_right:
initiator.on_press.emit(Initiator.EventType.GRIP)
grabbed_right = true
elif !grab_close&&grabbed_right:
initiator.on_release.emit(Initiator.EventType.GRIP)
grabbed_right = false
else:
if trigger_close&&!grabbed_right:
initiator.on_press.emit(Initiator.EventType.GRIP)
grabbed_right = true
elif !trigger_close&&grabbed_right:
initiator.on_release.emit(Initiator.EventType.GRIP)
grabbed_right = false
if grab_close&&!grabbed_right:
initiator.on_press.emit(Initiator.EventType.GRIP)
grabbed_right = true
elif !grab_close&&grabbed_right:
initiator.on_release.emit(Initiator.EventType.GRIP)
grabbed_right = false

View File

@ -1,29 +1,17 @@
[gd_scene load_steps=7 format=3 uid="uid://cbemihbxkd4ll"]
[gd_scene load_steps=5 format=3 uid="uid://cbemihbxkd4ll"]
[ext_resource type="Script" path="res://content/system/house/house.gd" id="1_p8amj"]
[ext_resource type="Script" path="res://content/functions/movable.gd" id="2_w1auk"]
[ext_resource type="PackedScene" uid="uid://jls16btb8nko" path="res://content/system/house/align_reference.tscn" id="3_e1tcn"]
[ext_resource type="PackedScene" uid="uid://c8nh8582vwc8u" path="res://content/system/house/doors/doors.tscn" id="4_bb3c2"]
[ext_resource type="PackedScene" uid="uid://ds60i5n211hi3" path="res://content/system/house/mini/miniature.tscn" id="4_qjbly"]
[sub_resource type="BoxShape3D" id="BoxShape3D_x81up"]
[node name="House" type="Node3D"]
script = ExtResource("1_p8amj")
[node name="Levels" type="StaticBody3D" parent="."]
[node name="Levels" type="Node3D" parent="."]
[node name="Level0" type="Node3D" parent="Levels"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Levels"]
shape = SubResource("BoxShape3D_x81up")
disabled = true
[node name="Movable" type="Node" parent="Levels"]
script = ExtResource("2_w1auk")
restricted = true
lock_rotation = true
[node name="Miniature" parent="Levels" instance=ExtResource("4_qjbly")]
[node name="Doors" parent="Levels" instance=ExtResource("4_bb3c2")]

View File

@ -96,6 +96,7 @@ func _ready():
var center=aabb.position + aabb.size / 2
collision_shape.shape.size=aabb.size * 0.1
collision_shape.position=center * 0.1
entity_select.position=Vector3(0, height * 0.1 + 0.1, 0)
var camera=$"/root/Main/XROrigin3D/XRCamera3D"

View File

@ -27,6 +27,7 @@ disabled = true
[node name="Movable" type="Node" parent="Body"]
script = ExtResource("2_x7oed")
restricted = true
resizable = true
[node name="Small" type="Node3D" parent="Body"]

View File

@ -86,7 +86,7 @@ func _process(_delta):
if Engine.is_editor_hint():
return
if get_tree().debug_collisions_hint&&OS.get_name() != "Android":
if get_tree().debug_collisions_hint:
_draw_debug_text_gaps()
func _on_press_down(event):

View File

@ -64,4 +64,4 @@ func _update_style():
func _update_size():
mesh.size = size
material_override.set_shader_parameter("size", size * 25)
material_override.set_shader_parameter("size", size * 25)

View File

@ -3,7 +3,7 @@
[ext_resource type="Script" path="res://content/ui/components/panel/panel.gd" id="1_2jq4a"]
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="1_mpdsy"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_2wxf7"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_koby5"]
resource_local_to_scene = true
render_priority = 10
shader = ExtResource("1_mpdsy")
@ -14,17 +14,15 @@ shader_parameter/size = Vector2(1, 1)
shader_parameter/border_size = 0.01
shader_parameter/border_fade_in = 0.05
shader_parameter/border_fade_out = 0.0
shader_parameter/corner_radius = 0.04
shader_parameter/corner_radius = 0.2
shader_parameter/roughness = 0.3
shader_parameter/grain_amount = 0.02
[sub_resource type="QuadMesh" id="QuadMesh_r8ntw"]
[sub_resource type="QuadMesh" id="QuadMesh_1r1mq"]
size = Vector2(0.04, 0.04)
[node name="Panel" type="MeshInstance3D"]
material_override = SubResource("ShaderMaterial_2wxf7")
mesh = SubResource("QuadMesh_r8ntw")
material_override = SubResource("ShaderMaterial_koby5")
mesh = SubResource("QuadMesh_1r1mq")
script = ExtResource("1_2jq4a")
size = Vector2(0.04, 0.04)
corner_radius = null
border = null

View File

@ -1,35 +0,0 @@
[gd_scene load_steps=6 format=3 uid="uid://6jhh4qy74px3"]
[ext_resource type="Script" path="res://content/ui/console.gd" id="1_ullcc"]
[ext_resource type="Script" path="res://content/functions/movable.gd" id="2_gfjlg"]
[sub_resource type="BoxShape3D" id="BoxShape3D_6xl4b"]
size = Vector3(1, 0.05, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_087gr"]
cull_mode = 2
[sub_resource type="QuadMesh" id="QuadMesh_chf50"]
[node name="Console" type="StaticBody3D"]
script = ExtResource("1_ullcc")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0)
shape = SubResource("BoxShape3D_6xl4b")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 1.06581e-14, 0, -1.06581e-14, 1, 0.01, 0, 0)
material_override = SubResource("StandardMaterial3D_087gr")
mesh = SubResource("QuadMesh_chf50")
[node name="Label3D" type="Label3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.477979, 0.492319, 0.001)
pixel_size = 0.001
text = "Texst
aaa"
horizontal_alignment = 0
vertical_alignment = 0
[node name="Movable" type="Node" parent="."]
script = ExtResource("2_gfjlg")

View File

@ -198,6 +198,7 @@ shape = SubResource("BoxShape3D_e1esh")
[node name="Movable" type="Node" parent="."]
script = ExtResource("2_8coxu")
resizable = false
[node name="AnimationContainer" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.23, 0.15, 0)
@ -225,38 +226,38 @@ size = Vector3(0.05, 0.4, 1)
[node name="View" parent="AnimationContainer/Tabs" instance=ExtResource("5_w4i01")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.025, 0)
label = "visibility"
size = Vector3(0.05, 0.05, 0.01)
icon = true
toggleable = true
disabled = true
size = Vector3(0.05, 0.05, 0.01)
[node name="Edit" parent="AnimationContainer/Tabs" instance=ExtResource("5_w4i01")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.085, 0)
label = "widgets"
size = Vector3(0.05, 0.05, 0.01)
icon = true
toggleable = true
size = Vector3(0.05, 0.05, 0.01)
[node name="Room" parent="AnimationContainer/Tabs" instance=ExtResource("5_w4i01")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.145, 0)
label = "view_in_ar"
size = Vector3(0.05, 0.05, 0.01)
icon = true
toggleable = true
size = Vector3(0.05, 0.05, 0.01)
[node name="Automate" parent="AnimationContainer/Tabs" instance=ExtResource("5_w4i01")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.205, 0)
label = "schema"
size = Vector3(0.05, 0.05, 0.01)
icon = true
toggleable = true
size = Vector3(0.05, 0.05, 0.01)
[node name="Settings" parent="AnimationContainer/Tabs" instance=ExtResource("5_w4i01")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.265, 0)
label = "settings"
size = Vector3(0.05, 0.05, 0.01)
icon = true
toggleable = true
size = Vector3(0.05, 0.05, 0.01)
[node name="TabsContent" type="Node3D" parent="AnimationContainer" node_paths=PackedStringArray("tabs")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, 0.00999999, 0)

View File

@ -6,11 +6,9 @@ var max_message = 30
var messages: Array = ["aaa", "bbb"]
func log(text: Variant) -> void:
messages.push_front(str(text))
messages.append(str(text))
if messages.size() > max_message:
messages.pop_back()
func _process(_delta: float) -> void:
messages.pop_front()
label.text = "\n".join(messages)

View File

@ -0,0 +1,53 @@
[gd_scene load_steps=8 format=3 uid="uid://87utftwh8lr6"]
[ext_resource type="PackedScene" uid="uid://dnam3fe36gg62" path="res://content/ui/components/panel/panel.tscn" id="1_3t6cp"]
[ext_resource type="Script" path="res://content/ui/ui_console.gd" id="1_ullcc"]
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="2_dbrjx"]
[ext_resource type="Script" path="res://content/functions/movable.gd" id="3_2a4np"]
[sub_resource type="BoxShape3D" id="BoxShape3D_mfp33"]
size = Vector3(1, 1, 0.01)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_p0lm6"]
resource_local_to_scene = true
render_priority = 10
shader = ExtResource("2_dbrjx")
shader_parameter/color = Color(1, 1, 1, 0.3)
shader_parameter/border_color = Color(1, 1, 1, 1)
shader_parameter/edge_color = Color(0, 0, 0, 1)
shader_parameter/size = Vector2(25, 25)
shader_parameter/border_size = 0.01
shader_parameter/border_fade_in = 0.05
shader_parameter/border_fade_out = 0.0
shader_parameter/corner_radius = 0.2
shader_parameter/roughness = 0.3
shader_parameter/grain_amount = 0.02
[sub_resource type="QuadMesh" id="QuadMesh_drxk8"]
[node name="Console" type="StaticBody3D"]
collision_layer = 2
collision_mask = 2
script = ExtResource("1_ullcc")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("BoxShape3D_mfp33")
[node name="Label3D" type="Label3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.48, -0.49, 0)
pixel_size = 0.001
text = "aaadddddddddddddddd dad addddddddddd ad awd ddddd dawd aw dwadaw wd dawdwdawd dwd dwdddd
aaa
aaa"
horizontal_alignment = 0
vertical_alignment = 2
autowrap_mode = 3
width = 980.0
[node name="Movable" type="Node" parent="."]
script = ExtResource("3_2a4np")
[node name="Panel" parent="." instance=ExtResource("1_3t6cp")]
material_override = SubResource("ShaderMaterial_p0lm6")
mesh = SubResource("QuadMesh_drxk8")
size = Vector2(1, 1)

View File

@ -1,28 +1,17 @@
extends Node
const console_scene = preload ("res://content/ui/console.tscn")
var _console: Node3D = null
@onready var main = get_node_or_null("/root/Main")
@onready var main = $"/root/Main"
@onready var console = $"/root/Main/Console"
func _ready():
if main == null:
return
await main.ready
main.tree_entered.connect(func():
init_console()
)
func init_console():
_console = console_scene.instantiate()
main.add_child(_console)
var camera = get_node("/root/Main/XROrigin3D/XRCamera3D")
_console.global_position = camera.global_position + camera.global_transform.basis.z * - 1
_console.global_transform.basis = Basis.looking_at(_console.global_position - camera.global_position)
main.remove_child(console)
func log(message):
print(message, _console)
if _console == null:
init_console()
print(message)
if console.get_parent() == null:
main.add_child(console)
_console.log(message)
console.log(message)

View File

@ -154,4 +154,4 @@ func get_history(entity_id, start, end=null):
if groups.is_group(entity_id):
return null
return await api.get_history(entity_id, start, end)
return await api.get_history(entity_id, start, end)

View File

@ -26,4 +26,4 @@ func _init():
)
func clear():
pass
pass

View File

@ -0,0 +1,58 @@
class_name TransformTools
## Calculate the transform that would transform the source position, direction and up vector to the target position, direction and up vector
## Basically a bit more fancy Inputs for a Transform3D
static func calc_delta_transform(source_pos: Vector3, source_dir: Vector3, source_up: Vector3, target_pos: Vector3, target_dir: Vector3, target_up: Vector3) -> Transform3D:
var source_transform = Transform3D()
source_transform.basis = Basis(source_dir, source_up, source_dir.cross(source_up)).orthonormalized() * (1.0 / source_dir.length())
source_transform.origin = source_pos
var target_transform = Transform3D()
target_transform.basis = Basis(target_dir, target_up, target_dir.cross(target_up)).orthonormalized() * (target_dir.length())
target_transform.origin = target_pos
return target_transform * source_transform.inverse()
## Rotate a transform around a point by an angle around an axis
static func rotate_around_point_axis(transform: Transform3D, point: Vector3, axis: Vector3, angle: float) -> Transform3D:
return transform.translated( - point).rotated(axis, angle).translated(point)
static func rotate_around_point(transform: Transform3D, point: Vector3, rotation: Vector3, rotation_order: EulerOrder=EULER_ORDER_YXZ) -> Transform3D:
transform = transform.translated( - point)
var axis1 = Vector3()
var axis2 = Vector3()
var axis3 = Vector3()
match rotation_order:
EULER_ORDER_XYZ:
axis1 = Vector3(1, 0, 0)
axis2 = Vector3(0, 1, 0)
axis3 = Vector3(0, 0, 1)
EULER_ORDER_XZY:
axis1 = Vector3(1, 0, 0)
axis2 = Vector3(0, 0, 1)
axis3 = Vector3(0, 1, 0)
rotation = Vector3(rotation.x, rotation.z, rotation.y)
EULER_ORDER_YXZ:
axis1 = Vector3(0, 1, 0)
axis2 = Vector3(1, 0, 0)
axis3 = Vector3(0, 0, 1)
rotation = Vector3(rotation.y, rotation.x, rotation.z)
EULER_ORDER_YZX:
axis1 = Vector3(0, 1, 0)
axis2 = Vector3(0, 0, 1)
axis3 = Vector3(1, 0, 0)
rotation = Vector3(rotation.y, rotation.z, rotation.x)
EULER_ORDER_ZXY:
axis1 = Vector3(0, 0, 1)
axis2 = Vector3(1, 0, 0)
axis3 = Vector3(0, 1, 0)
rotation = Vector3(rotation.z, rotation.x, rotation.y)
EULER_ORDER_ZYX:
axis1 = Vector3(0, 0, 1)
axis2 = Vector3(0, 1, 0)
axis3 = Vector3(1, 0, 0)
rotation = Vector3(rotation.z, rotation.y, rotation.x)
transform = transform.rotated(axis1, rotation.x).rotated(axis2, rotation.y).rotated(axis3, rotation.z)
return transform.translated(point)

View File

@ -12,7 +12,7 @@ config_version=5
config/name="ImmersiveHome"
run/main_scene="res://content/main.tscn"
config/features=PackedStringArray("4.2", "Mobile")
config/features=PackedStringArray("4.2", "GL Compatibility")
config/icon="res://assets/logo.png"
[audio]
@ -22,21 +22,16 @@ driver/enable_input=true
[autoload]
XRToolsUserSettings="*res://addons/godot-xr-tools/user_settings/user_settings.gd"
Request="*res://lib/globals/request.gd"
HomeApi="*res://lib/globals/home_api.gd"
AudioPlayer="*res://lib/globals/audio_player.gd"
EventSystem="*res://lib/globals/event_system.gd"
HomeApi="*res://lib/globals/home_api.gd"
Store="*res://lib/globals/main_store.gd"
EventSystem="*res://lib/globals/event_system.gd"
House="*res://lib/globals/house_body.gd"
console="*res://lib/globals/console.gd"
[display]
window/vsync/vsync_mode=0
Request="*res://lib/globals/request.gd"
[editor_plugins]
enabled=PackedStringArray("res://addons/godot-xr-tools/plugin.cfg", "res://addons/godotopenxrvendors/plugin.cfg")
enabled=PackedStringArray("res://addons/godot-xr-tools/plugin.cfg")
[file_customization]
@ -71,9 +66,6 @@ common/physics_ticks_per_second=30
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
textures/vram_compression/import_etc2_astc=true
lights_and_shadows/directional_shadow/soft_shadow_filter_quality=4
lights_and_shadows/directional_shadow/soft_shadow_filter_quality.mobile=4
anti_aliasing/quality/msaa_3d=1
viewport/transparent_background=true
[xr]

View File

@ -0,0 +1,20 @@
extends Node3D
@onready var source = $Source
@onready var target = $Target
@onready var soruce_point = $SourcePoint
@onready var target_point = $TargetPoint
func _process(delta):
source.rotate_y(deg_to_rad(10) * delta)
source.rotate_x(deg_to_rad(20) * delta)
source.scale = Vector3(1, 1, 1) * 0.75 + Vector3(1, 1, 1) * 0.25 * sin(Time.get_ticks_msec() * 0.001)
var source_pos = source.global_position
var source_dir = source.global_transform.basis.z
var source_up = Vector3.UP
var target_pos = target.global_position
var target_dir = target.global_transform.basis.z
var target_up = Vector3.UP
target_point.global_position = TransformTools.calc_delta_transform(source_pos, source_dir, source_up, target_pos, target_dir, target_up) * soruce_point.global_position

View File

@ -0,0 +1,76 @@
[gd_scene load_steps=9 format=3 uid="uid://cru8oxovmssaf"]
[ext_resource type="Script" path="res://test/lib/utils/transform_tools/calc_delta_transform.gd" id="1_26n8o"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_c35o8"]
sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
[sub_resource type="Sky" id="Sky_gaxug"]
sky_material = SubResource("ProceduralSkyMaterial_c35o8")
[sub_resource type="Environment" id="Environment_gr63f"]
background_mode = 2
sky = SubResource("Sky_gaxug")
tonemap_mode = 2
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_2hoe7"]
albedo_color = Color(1, 0, 0, 1)
[sub_resource type="CylinderMesh" id="CylinderMesh_g2kmn"]
top_radius = 0.01
bottom_radius = 0.06
height = 1.0
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_gj3vb"]
albedo_color = Color(0, 1, 0, 1)
[sub_resource type="BoxMesh" id="BoxMesh_3dprm"]
size = Vector3(0.02, 0.02, 0.02)
[node name="Node3D" type="Node3D"]
script = ExtResource("1_26n8o")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_gr63f")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(-0.866023, -0.433016, 0.250001, 0, 0.499998, 0.866027, -0.500003, 0.749999, -0.43301, 0, 0, 0)
shadow_enabled = true
[node name="Source" type="Node3D" parent="."]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Source"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0.5)
material_override = SubResource("StandardMaterial3D_2hoe7")
mesh = SubResource("CylinderMesh_g2kmn")
skeleton = NodePath("../..")
[node name="Target" type="Node3D" parent="."]
transform = Transform3D(-0.5, 0, 0.866025, 0, 1, 0, -0.866025, 0, -0.5, 0.3, 0, -0.3)
[node name="MeshInstance3D" type="MeshInstance3D" parent="Target"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0.5)
material_override = SubResource("StandardMaterial3D_gj3vb")
mesh = SubResource("CylinderMesh_g2kmn")
skeleton = NodePath("../..")
[node name="SourcePoint" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1)
[node name="MeshInstance3D" type="MeshInstance3D" parent="SourcePoint"]
material_override = SubResource("StandardMaterial3D_2hoe7")
mesh = SubResource("BoxMesh_3dprm")
skeleton = NodePath("../..")
[node name="TargetPoint" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.19661, 0, 0.240314)
[node name="MeshInstance3D" type="MeshInstance3D" parent="TargetPoint"]
material_override = SubResource("StandardMaterial3D_gj3vb")
mesh = SubResource("BoxMesh_3dprm")
skeleton = NodePath("../../SourcePoint")
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(0.760406, -0.30989, 0.570746, 0, 0.878817, 0.477159, -0.649448, -0.362834, 0.668258, 1.40734, 1.17657, 1.64778)
current = true

View File

@ -0,0 +1,10 @@
extends Node3D
@onready var box = $Box
@onready var box2 = $Box2
func _process(delta):
var rad = deg_to_rad(20) * delta
box.global_transform = TransformTools.rotate_around_point_axis(box.global_transform, Vector3(0.5, 0.5, 0.5), Vector3(0, 1, 0), rad)
box2.global_transform = TransformTools.rotate_around_point(box2.global_transform, Vector3(0.5, 0.5, 0.5), Vector3( - rad, -rad, 0))

View File

@ -0,0 +1,45 @@
[gd_scene load_steps=8 format=3 uid="uid://cy8qeuw1q8jk0"]
[ext_resource type="Script" path="res://test/lib/utils/transform_tools/rotate_around_point.gd" id="1_k7wsf"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_p5i6n"]
sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
[sub_resource type="Sky" id="Sky_oxf7q"]
sky_material = SubResource("ProceduralSkyMaterial_p5i6n")
[sub_resource type="Environment" id="Environment_l7w2l"]
background_mode = 2
sky = SubResource("Sky_oxf7q")
tonemap_mode = 2
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pssmf"]
albedo_color = Color(1, 0, 0, 1)
[sub_resource type="BoxMesh" id="BoxMesh_gomx4"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_xf20j"]
albedo_color = Color(0, 1, 0, 1)
[node name="Node3D" type="Node3D"]
script = ExtResource("1_k7wsf")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_l7w2l")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(-0.866023, -0.433016, 0.250001, 0, 0.499998, 0.866027, -0.500003, 0.749999, -0.43301, 0, 0, 0)
shadow_enabled = true
[node name="Box" type="MeshInstance3D" parent="."]
material_override = SubResource("StandardMaterial3D_pssmf")
mesh = SubResource("BoxMesh_gomx4")
[node name="Box2" type="MeshInstance3D" parent="."]
material_override = SubResource("StandardMaterial3D_xf20j")
mesh = SubResource("BoxMesh_gomx4")
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(0.877583, -0.229849, 0.420735, 0, 0.877583, 0.479426, -0.479426, -0.420736, 0.770151, 1.68294, 1.9177, 3.0806)
current = true