Clean up debug prints + smooth bezier

This commit is contained in:
Vojtěch Struhár 2025-02-24 17:14:12 +01:00
parent 3834d282ca
commit 3187c3d359
5 changed files with 3 additions and 47 deletions

View File

@ -4,7 +4,6 @@ extends EditorNode3DGizmoPlugin
func _init():
print("[gizmo] _init")
create_material("main", Color(1,0,1), false, true, false)
create_material("secondary", Color(1,0,0))
func _get_gizmo_name() -> String:
@ -13,25 +12,20 @@ func _get_gizmo_name() -> String:
func _has_gizmo(for_node_3d: Node3D) -> bool:
var result: bool = for_node_3d is Portal
if result: print("[gizmo] _has_gizmo: " + for_node_3d.name)
return result
func _redraw(gizmo):
var portal = gizmo.get_node_3d() as Portal
print("[gizmo] _redraw: " + portal.name)
gizmo.clear() # Always clear the gizmo
if portal not in EditorInterface.get_selection().get_selected_nodes():
return # If not selected, don't draw anything
var lines = PackedVector3Array()
if portal.exit_portal != null:
print("[gizmo] Drawing the bezier")
# Draw a bezier curve connecting the two portals
var exit = portal.exit_portal
var D = portal.global_position.distance_to(exit.global_position)
@ -59,10 +53,9 @@ func _redraw(gizmo):
+ pow(t, 3) * p3
lines.push_back(spline_pos)
lines.push_back(spline_pos)
lines.push_back(p3)
gizmo.add_lines(PackedVector3Array([p0, p3, p1, p2]), get_material("secondary", gizmo))
#var handles = PackedVector3Array()
#handles.push_back(Vector3(0, 1, 0))

View File

@ -1,12 +0,0 @@
@tool
extends Node
@onready var indicator: MeshInstance3D = $Indicator
func _process(delta: float) -> void:
var p = get_parent() as Node3D
if p:
indicator.global_position = p.global_position
indicator.global_position -= p.global_transform.basis.z

View File

@ -1 +0,0 @@
uid://cls46uawo3qq

View File

@ -1,19 +0,0 @@
[gd_scene load_steps=4 format=3 uid="uid://b3igtxttykf7i"]
[ext_resource type="Script" uid="uid://cls46uawo3qq" path="res://forward_pointer.gd" id="1_cde0p"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_anedn"]
albedo_color = Color(1, 0, 1, 1)
emission_enabled = true
emission = Color(0.425891, 0.000125429, 0.425888, 1)
[sub_resource type="SphereMesh" id="SphereMesh_n0wat"]
material = SubResource("StandardMaterial3D_anedn")
radius = 0.25
height = 0.5
[node name="ForwardPointer" type="Node"]
script = ExtResource("1_cde0p")
[node name="Indicator" type="MeshInstance3D" parent="."]
mesh = SubResource("SphereMesh_n0wat")

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=3 uid="uid://27pb62xwsqd8"]
[gd_scene load_steps=12 format=3 uid="uid://27pb62xwsqd8"]
[ext_resource type="PackedScene" uid="uid://b5x7fmpwck335" path="res://hud.tscn" id="1_mmt1i"]
[ext_resource type="MeshLibrary" uid="uid://bedqgubx1g1uf" path="res://prototypes.tres" id="2_vdsn8"]
@ -6,7 +6,6 @@
[ext_resource type="Script" uid="uid://d2bvvjsibau8c" path="res://addons/simple-portal-system/scripts/portal.gd" id="4_top28"]
[ext_resource type="Script" uid="uid://bkv7t4hw21byg" path="res://addons/simple-portal-system/scripts/simple_portal_teleport.gd" id="5_evjit"]
[ext_resource type="PackedScene" uid="uid://cgdlowfuuorvi" path="res://player.tscn" id="6_hlt8e"]
[ext_resource type="PackedScene" uid="uid://b3igtxttykf7i" path="res://forward_pointer.tscn" id="6_vdsn8"]
[ext_resource type="Script" uid="uid://cili3lyodjqel" path="res://portal_environment_adapter.gd" id="7_2gewm"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_b0o0q"]
@ -62,8 +61,6 @@ script = ExtResource("5_evjit")
transform = Transform3D(1, 0, 4.72511e-13, 0, 1, 0, -4.72511e-13, 0, 1, 0, 0, -0.250244)
shape = SubResource("BoxShape3D_cgnft")
[node name="ForwardPointer" parent="Portal_red" instance=ExtResource("6_vdsn8")]
[node name="Portal_orange" type="MeshInstance3D" parent="." node_paths=PackedStringArray("exit_portal")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 2, -0.5)
mesh = ExtResource("3_c4jka")
@ -83,8 +80,6 @@ script = ExtResource("5_evjit")
transform = Transform3D(1, 0, 4.72511e-13, 0, 1, 0, -4.72511e-13, 0, 1, 0, 0, -0.250244)
shape = SubResource("BoxShape3D_cgnft")
[node name="ForwardPointer" parent="Portal_orange" instance=ExtResource("6_vdsn8")]
[node name="Player" parent="." instance=ExtResource("6_hlt8e")]
transform = Transform3D(0.727006, 0, 0.686631, 0, 1, 0, -0.686631, 0, 0.727006, 4.51826, 1.08552, 4.0716)