Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3187c3d359 | ||
|
|
3834d282ca |
No files matched your search
@@ -4,7 +4,6 @@ extends EditorNode3DGizmoPlugin
|
|||||||
func _init():
|
func _init():
|
||||||
print("[gizmo] _init")
|
print("[gizmo] _init")
|
||||||
create_material("main", Color(1,0,1), false, true, false)
|
create_material("main", Color(1,0,1), false, true, false)
|
||||||
create_material("secondary", Color(1,0,0))
|
|
||||||
|
|
||||||
|
|
||||||
func _get_gizmo_name() -> String:
|
func _get_gizmo_name() -> String:
|
||||||
@@ -13,38 +12,39 @@ func _get_gizmo_name() -> String:
|
|||||||
|
|
||||||
func _has_gizmo(for_node_3d: Node3D) -> bool:
|
func _has_gizmo(for_node_3d: Node3D) -> bool:
|
||||||
var result: bool = for_node_3d is Portal
|
var result: bool = for_node_3d is Portal
|
||||||
if result: print("[gizmo] _has_gizmo: " + for_node_3d.name)
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
func _redraw(gizmo):
|
func _redraw(gizmo):
|
||||||
var portal = gizmo.get_node_3d() as Portal
|
var portal = gizmo.get_node_3d() as Portal
|
||||||
print("[gizmo] _redraw: " + portal.name)
|
|
||||||
|
|
||||||
gizmo.clear() # Always clear the gizmo
|
gizmo.clear() # Always clear the gizmo
|
||||||
|
|
||||||
if portal not in EditorInterface.get_selection().get_selected_nodes():
|
if portal not in EditorInterface.get_selection().get_selected_nodes():
|
||||||
return # If not selected, don't draw anything
|
return # If not selected, don't draw anything
|
||||||
|
|
||||||
|
|
||||||
var lines = PackedVector3Array()
|
var lines = PackedVector3Array()
|
||||||
|
|
||||||
|
|
||||||
if portal.exit_portal != null:
|
if portal.exit_portal != null:
|
||||||
print("[gizmo] Drawing the bezier")
|
|
||||||
# Draw a bezier curve connecting the two portals
|
# Draw a bezier curve connecting the two portals
|
||||||
var exit = portal.exit_portal
|
var exit = portal.exit_portal
|
||||||
var D = portal.global_position.distance_to(exit.global_position)
|
var D = portal.global_position.distance_to(exit.global_position)
|
||||||
|
|
||||||
var p0 = Vector3.ZERO
|
var p0 = portal.global_position
|
||||||
var p3 = portal.to_local(exit.global_position)
|
var p3 = exit.global_position
|
||||||
var p1 = p0 + -portal.transform.basis.z * D * 0.25 # Control point
|
|
||||||
var p2 = p3 + -exit.transform.basis.z * D * 0.25 # Control point
|
|
||||||
|
|
||||||
var RESOLUTION: int = 24
|
var p1 = p0 -portal.global_transform.basis.z * D * 0.25
|
||||||
|
var p2 = p3 -exit.global_transform.basis.z * D * 0.25
|
||||||
|
|
||||||
|
|
||||||
|
p0 = portal.to_local(p0)
|
||||||
|
p1 = portal.to_local(p1)
|
||||||
|
p2 = portal.to_local(p2)
|
||||||
|
p3 = portal.to_local(p3)
|
||||||
|
|
||||||
lines.push_back(p0)
|
lines.push_back(p0)
|
||||||
|
|
||||||
|
const RESOLUTION: int = 24
|
||||||
for i in range(1, RESOLUTION + 1):
|
for i in range(1, RESOLUTION + 1):
|
||||||
var t: float = float(i) / RESOLUTION
|
var t: float = float(i) / RESOLUTION
|
||||||
var spline_pos: Vector3 = pow(1 - t, 3) * p0 \
|
var spline_pos: Vector3 = pow(1 - t, 3) * p0 \
|
||||||
@@ -53,13 +53,9 @@ func _redraw(gizmo):
|
|||||||
+ pow(t, 3) * p3
|
+ pow(t, 3) * p3
|
||||||
|
|
||||||
lines.push_back(spline_pos)
|
lines.push_back(spline_pos)
|
||||||
|
lines.push_back(spline_pos)
|
||||||
|
|
||||||
lines.push_back(p3)
|
lines.push_back(p3)
|
||||||
print("[gizmo] Bezier lines: " + str(lines.size()))
|
|
||||||
|
|
||||||
gizmo.add_lines(PackedVector3Array([p0, p3, p1, p2]), get_material("secondary", gizmo))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#var handles = PackedVector3Array()
|
#var handles = PackedVector3Array()
|
||||||
#handles.push_back(Vector3(0, 1, 0))
|
#handles.push_back(Vector3(0, 1, 0))
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
[gd_scene load_steps=11 format=3 uid="uid://dfp37ydmk0iqd"]
|
|
||||||
|
|
||||||
[ext_resource type="Material" uid="uid://dm157s57mfhfe" path="res://addons/kenney_prototype_tools/materials/dark/material_02.tres" id="1_7g3li"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://c1r8mgwbekvi6" path="res://models/cube-wireframe.glb" id="2_k5v63"]
|
|
||||||
[ext_resource type="ArrayMesh" uid="uid://bqilnvlfws6xh" path="res://portal-mesh.tres" id="3_xriuu"]
|
|
||||||
[ext_resource type="Script" uid="uid://d2bvvjsibau8c" path="res://addons/simple-portal-system/scripts/portal.gd" id="4_b1ttb"]
|
|
||||||
[ext_resource type="Script" uid="uid://bkv7t4hw21byg" path="res://addons/simple-portal-system/scripts/simple_portal_teleport.gd" id="5_r7ouk"]
|
|
||||||
|
|
||||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_gkglg"]
|
|
||||||
sky_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
|
|
||||||
ground_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
|
|
||||||
|
|
||||||
[sub_resource type="Sky" id="Sky_7g3li"]
|
|
||||||
sky_material = SubResource("ProceduralSkyMaterial_gkglg")
|
|
||||||
|
|
||||||
[sub_resource type="Environment" id="Environment_k5v63"]
|
|
||||||
background_mode = 2
|
|
||||||
sky = SubResource("Sky_7g3li")
|
|
||||||
tonemap_mode = 2
|
|
||||||
glow_enabled = true
|
|
||||||
|
|
||||||
[sub_resource type="BoxMesh" id="BoxMesh_gkglg"]
|
|
||||||
size = Vector3(40, 1, 40)
|
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_wgwtu"]
|
|
||||||
size = Vector3(2, 2, 0.5)
|
|
||||||
|
|
||||||
[node name="Hypercube" type="Node3D"]
|
|
||||||
|
|
||||||
[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="WorldEnvironment" type="WorldEnvironment" parent="."]
|
|
||||||
environment = SubResource("Environment_k5v63")
|
|
||||||
|
|
||||||
[node name="StaticBody3D" type="StaticBody3D" parent="."]
|
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
|
|
||||||
|
|
||||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="StaticBody3D"]
|
|
||||||
material_override = ExtResource("1_7g3li")
|
|
||||||
mesh = SubResource("BoxMesh_gkglg")
|
|
||||||
|
|
||||||
[node name="cube-wireframe" parent="." instance=ExtResource("2_k5v63")]
|
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
|
||||||
|
|
||||||
[node name="Portal_red" type="MeshInstance3D" parent="." node_paths=PackedStringArray("exit_portal")]
|
|
||||||
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -1, 1, 0)
|
|
||||||
mesh = ExtResource("3_xriuu")
|
|
||||||
skeleton = NodePath("")
|
|
||||||
script = ExtResource("4_b1ttb")
|
|
||||||
vertical_viewport_resolution = 1080
|
|
||||||
disable_viewport_distance = 32.0
|
|
||||||
fade_out_distance_max = 30.0
|
|
||||||
fade_out_distance_min = 28.0
|
|
||||||
fade_out_color = Color(0, 0, 0, 1)
|
|
||||||
exit_portal = NodePath("")
|
|
||||||
|
|
||||||
[node name="Teleport" type="Area3D" parent="Portal_red"]
|
|
||||||
script = ExtResource("5_r7ouk")
|
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Portal_red/Teleport"]
|
|
||||||
transform = Transform3D(1, 0, 4.72511e-13, 0, 1, 0, -4.72511e-13, 0, 1, 0, 0, -0.250244)
|
|
||||||
shape = SubResource("BoxShape3D_wgwtu")
|
|
||||||
Binary file not shown.
@@ -1,37 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="scene"
|
|
||||||
importer_version=1
|
|
||||||
type="PackedScene"
|
|
||||||
uid="uid://c1r8mgwbekvi6"
|
|
||||||
path="res://.godot/imported/cube-wireframe.glb-967ab7c5c0b5cb7833d30e3afe2cbbe7.scn"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://models/cube-wireframe.glb"
|
|
||||||
dest_files=["res://.godot/imported/cube-wireframe.glb-967ab7c5c0b5cb7833d30e3afe2cbbe7.scn"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
nodes/root_type=""
|
|
||||||
nodes/root_name=""
|
|
||||||
nodes/apply_root_scale=true
|
|
||||||
nodes/root_scale=1.0
|
|
||||||
nodes/import_as_skeleton_bones=false
|
|
||||||
nodes/use_node_type_suffixes=true
|
|
||||||
meshes/ensure_tangents=true
|
|
||||||
meshes/generate_lods=true
|
|
||||||
meshes/create_shadow_meshes=true
|
|
||||||
meshes/light_baking=1
|
|
||||||
meshes/lightmap_texel_size=0.2
|
|
||||||
meshes/force_disable_compression=false
|
|
||||||
skins/use_named_skins=true
|
|
||||||
animation/import=true
|
|
||||||
animation/fps=30
|
|
||||||
animation/trimming=false
|
|
||||||
animation/remove_immutable_tracks=true
|
|
||||||
animation/import_rest_as_RESET=false
|
|
||||||
import_script/path=""
|
|
||||||
_subresources={}
|
|
||||||
gltf/naming_version=1
|
|
||||||
gltf/embedded_image_handling=1
|
|
||||||
Reference in new issue
Block a user