Basic stairs and player setup

This commit is contained in:
Vojta committed 2025-05-13 11:12:06 +02:00
commit dd7c490140
36 files changed
+1681

No files matched your search

@@ -0,0 +1,58 @@
extends EditorNode3DGizmoPlugin
func _init() -> void:
var exit_outline_color = PortalSettings.get_setting("gizmo_exit_outline_color")
create_material("outline", exit_outline_color, false, true, false)
func _get_gizmo_name() -> String:
return "PortalExitOutlineGizmo"
func _has_gizmo(for_node_3d: Node3D) -> bool:
return for_node_3d is Portal3D
func _redraw(gizmo: EditorNode3DGizmo) -> void:
var portal = gizmo.get_node_3d() as Portal3D
assert(portal != null, "This gizmo works only for Portal3D")
gizmo.clear()
if portal not in EditorInterface.get_selection().get_selected_nodes():
return
var ep: Portal3D = portal.exit_portal
if ep == null:
return
var extents = Vector3(ep.portal_size.x, ep.portal_size.y, ep._portal_thickness) / 2
var lines: Array[Vector3] = [
# Front rect
extents, extents * Vector3(1, -1, 1),
extents, extents * Vector3(-1, 1, 1),
extents * Vector3(1, -1, 1), extents * Vector3(-1, -1, 1),
extents * Vector3(-1, 1, 1), extents * Vector3(-1, -1, 1),
# Back rect
- extents, -extents * Vector3(1, -1, 1),
- extents, -extents * Vector3(-1, 1, 1),
- extents * Vector3(1, -1, 1), -extents * Vector3(-1, -1, 1),
- extents * Vector3(-1, 1, 1), -extents * Vector3(-1, -1, 1),
# Short Z connections
extents * Vector3(1, 1, 1), extents * Vector3(1, 1, -1),
extents * Vector3(1, -1, 1), extents * Vector3(1, -1, -1),
extents * Vector3(-1, 1, 1), extents * Vector3(-1, 1, -1),
extents * Vector3(-1, -1, 1), extents * Vector3(-1, -1, -1),
]
# Double each line for visual thickness
#for i in range(lines.size()):
#lines.append(lines[i] + (lines[i].normalized() * 0.005))
for i in range(lines.size()):
lines[i] = portal.to_local(ep.to_global(lines[i]))
gizmo.add_lines(
PackedVector3Array(lines),
get_material("outline", gizmo)
)
@@ -0,0 +1 @@
uid://pk5ua52g54m1
@@ -0,0 +1,39 @@
extends EditorNode3DGizmoPlugin
func _init() -> void:
var forward_color = PortalSettings.get_setting("gizmo_forward_color")
create_material("forward", forward_color, false, false, false)
func _get_gizmo_name() -> String:
return "PortalForwardDirectionGizmo"
func _has_gizmo(for_node_3d: Node3D) -> bool:
return for_node_3d is Portal3D
func _redraw(gizmo: EditorNode3DGizmo) -> void:
var portal = gizmo.get_node_3d() as Portal3D
assert(portal != null, "This gizmo works only for Portal3D")
var active: bool = portal in EditorInterface.get_selection().get_selected_nodes()
gizmo.clear()
var lines: Array[Vector3] = [
Vector3.ZERO, Vector3(0, 0, 1)
]
if active:
var arrow_spread = 0.05
lines.append_array([
Vector3(0, 0, 1), Vector3(arrow_spread, -arrow_spread, 0.9),
Vector3(0, 0, 1), Vector3(-arrow_spread, arrow_spread, 0.9),
])
var offset = 0.005
for i in range(lines.size()):
var p = lines[i]
lines.append(Vector3(p.x + offset, p.y + offset, p.z))
gizmo.add_lines(
PackedVector3Array(lines),
get_material("forward", gizmo)
)
@@ -0,0 +1 @@
uid://cacoywhcpn4ja