Files
przygody-pana-cegly/addons/phantom_camera/scripts/gizmos/phantom_camera_3d_gizmo.gd
Gabriel Kaszewski d786ef4c22 Complete C# rewrite with working game in Editor (#6)
* Refactor collectable components to C# and update resource scripts for consistency

* Update resource paths and refactor properties for consistency

* Refactor UI components to inherit from Control and update node paths for consistency

* Update node paths and group assignments for consistency across scenes

* Refactor GameManager and PlayerDeathComponent for improved state management and logging; update scene connections for player death handling

* Add PhantomCamera components and UI elements for improved scene management; refactor existing components for better integration

* Refactor skill components and update resource paths for consistency; enhance skill management in scenes

* Add new UID files and update scene configurations for dialogue components; refactor skill management and input handling

* Add next level command and refactor player retrieval in GameManager; update scene files for consistency

* Add skill upgrade system and refactor skill components for enhanced functionality; update resource paths and configurations

* Enhance ChargeProgressBar and Marketplace functionality; add owner exit handling and update skill button states

* Refactor ChargeProgressBar and SkillManager; update skill handling and improve component interactions

* Refactor player and level configurations; streamline FlipPlayerComponent and reposition Spaceship Enter
2025-08-27 01:12:26 +02:00

85 lines
2.6 KiB
GDScript
Vendored

@tool
extends EditorNode3DGizmo
#var pcam_3d: PhantomCamera3D
func _redraw() -> void:
clear()
var icon: Material = get_plugin().get_material(get_plugin().get_name(), self)
add_unscaled_billboard(icon, 0.035)
var pcam_3d: PhantomCamera3D = get_node_3d()
# if pcam_3d.is_following():
# _draw_target(pcam_3d, pcam_3d.get_follow_target_position(), "follow_target")
# if pcam_3d.is_looking_at():
# _draw_target(pcam_3d, pcam_3d.get_look_at_target_position(), "look_at_target")
if pcam_3d.is_active(): return
var frustum_lines: PackedVector3Array = PackedVector3Array()
var height: float = 0.25
var width: float = height * 1.25
var forward: float = height * -1.5
# Trapezoid
frustum_lines.push_back(Vector3.ZERO)
frustum_lines.push_back(Vector3(-width, height, forward))
frustum_lines.push_back(Vector3.ZERO)
frustum_lines.push_back(Vector3(width, height, forward))
frustum_lines.push_back(Vector3.ZERO)
frustum_lines.push_back(Vector3(-width, -height, forward))
frustum_lines.push_back(Vector3.ZERO)
frustum_lines.push_back(Vector3(width, -height, forward))
#######
# Frame
#######
## Left
frustum_lines.push_back(Vector3(-width, height, forward))
frustum_lines.push_back(Vector3(-width, -height, forward))
## Bottom
frustum_lines.push_back(Vector3(-width, -height, forward))
frustum_lines.push_back(Vector3(width, -height, forward))
## Right
frustum_lines.push_back(Vector3(width, -height, forward))
frustum_lines.push_back(Vector3(width, height, forward))
## Top
frustum_lines.push_back(Vector3(width, height, forward))
frustum_lines.push_back(Vector3(-width, height, forward))
##############
# Up Direction
##############
var up_height: float = height + 0.15
var up_width: float = width / 3
## Left
frustum_lines.push_back(Vector3(0, up_height, forward))
frustum_lines.push_back(Vector3(-up_width, height, forward))
## Right
frustum_lines.push_back(Vector3(0, up_height, forward))
frustum_lines.push_back(Vector3(up_width, height, forward))
var frustum_material: StandardMaterial3D = get_plugin().get_material("frustum", self)
add_lines(frustum_lines, frustum_material, false)
func _draw_target(pcam_3d: Node3D, target_position: Vector3, type: String) -> void:
var target_lines: PackedVector3Array = PackedVector3Array()
var direction: Vector3 = target_position - pcam_3d.global_position
var end_position: Vector3 = pcam_3d.global_basis.z * direction
target_lines.push_back(Vector3.ZERO)
target_lines.push_back(end_position)
var target_material: StandardMaterial3D = get_plugin().get_material(type, self)
add_lines(target_lines, target_material, false)