remove DebugCollisionShape

This commit is contained in:
2025-08-29 19:23:34 +10:00
parent 5b391cba27
commit 896e187aa2
10 changed files with 126 additions and 221 deletions

View File

@@ -1,68 +0,0 @@
class_name DebugCollisionShapes
const MARGIN = 0.01
var is_visible: bool = true
var _mesh_nodes: Array[MeshInstance3D] = []
func init(children: Array[Node], parent: Node, material: Material) -> void:
for child in children:
if child is not CollisionShape3D:
continue
var shape_node: CollisionShape3D = child as CollisionShape3D
if shape_node.shape == null:
continue
var mesh_node := MeshInstance3D.new()
if shape_node.shape is BoxShape3D:
var shape := shape_node.shape as BoxShape3D
var mesh := BoxMesh.new()
mesh.size = shape.size
mesh_node.mesh = mesh
if shape_node.shape is CapsuleShape3D:
var shape := shape_node.shape as CapsuleShape3D
var mesh := CapsuleMesh.new()
mesh.radius = shape.radius + MARGIN
mesh.height = shape.height + MARGIN
mesh.radial_segments = 8
mesh.rings = 1
mesh_node.mesh = mesh
if shape_node.shape is SphereShape3D:
var shape := shape_node.shape as SphereShape3D
var mesh := SphereMesh.new()
mesh.radius = shape.radius + MARGIN
mesh.height = shape.radius * 2 + MARGIN
mesh.radial_segments = 8
mesh.rings = 4
mesh_node.mesh = mesh
if shape_node.shape is CylinderShape3D:
var shape := shape_node.shape as CylinderShape3D
var mesh := CylinderMesh.new()
mesh.top_radius = shape.radius + MARGIN
mesh.bottom_radius = shape.radius + MARGIN
mesh.height = shape.height + MARGIN
mesh.radial_segments = 8
mesh.rings = 0
mesh_node.mesh = mesh
mesh_node.material_override = material
mesh_node.cast_shadow = GeometryInstance3D.SHADOW_CASTING_SETTING_OFF
mesh_node.visible = Debugger.mode == Debugger.Mode.FULL
parent.add_child(mesh_node)
mesh_node.global_transform = (child as Node3D).global_transform
_mesh_nodes.append(mesh_node)
Debugger.mode_changed.connect(_on_debugger_mode_changed)
func set_visibility(visible: bool) -> void:
is_visible = visible
for node in _mesh_nodes:
node.visible = is_visible and Debugger.mode == Debugger.Mode.FULL
func _on_debugger_mode_changed(mode: Debugger.Mode) -> void:
for mesh_node in _mesh_nodes:
mesh_node.visible = mode == Debugger.Mode.FULL

View File

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

View File

@@ -39,6 +39,7 @@ func _ready() -> void:
assert(_label2, str(self) + ": _label2 missing!")
assert(_label3, str(self) + ": _label2 missing!")
assert(_label4, str(self) + ": _label2 missing!")
instance = self
_control.draw.connect(_on_control_draw)
Inputer.mode_changed.connect(_on_inputer_mode_changed)
# enabled = OS.has_feature("editor")
@@ -89,7 +90,9 @@ static func vector(
if not show_debug():
return
instance._vectors_to_draw[key] = {"from": from, "to": to, "color": color, "on": true}
instance._vectors_to_draw[key] = {
"from": from, "to": to, "color": color, "on": true
}
static func line(
@@ -110,7 +113,9 @@ static func marker(
if not show_debug():
return
instance._markers_to_draw[key] = ({"pos": pos, "radius": radius, "color": color, "on": true})
instance._markers_to_draw[key] = ({
"pos": pos, "radius": radius, "color": color, "on": true
})
static func circle(key: String, pos: Vector3, color: Color = DEFAULT_COLOR) -> void:

View File

@@ -9,7 +9,6 @@ static var instances: Array[Player]
@export var _device_index: int = 0
@export var _respawn_height: float = -5
@export var _collision_debug_material: Material
@export_group("References")
@export var attack: PlayerAttacker
@@ -20,7 +19,6 @@ var movement: PlayerMovementHandler = PlayerMovementHandler.new()
var aiming: PlayerAimingHandler = PlayerAimingHandler.new()
var _respawn_point: Vector3
var _debug_collision_shapes := DebugCollisionShapes.new()
static func is_single_player() -> bool:
@@ -30,7 +28,6 @@ static func is_single_player() -> bool:
func _ready() -> void:
_respawn_point = global_position
instances.append(self)
_debug_collision_shapes.init(get_children(), self, _collision_debug_material)
func _process(_delta: float) -> void:

View File

@@ -26,8 +26,6 @@ enum Side { RIGHT, LEFT }
var side := Side.RIGHT
var _debug_collision_shapes := DebugCollisionShapes.new()
var _cooldown_timer: float
var _hit_window_timer: float
var _queue_hit_stop: bool
@@ -43,7 +41,6 @@ func _ready() -> void:
position.y = Projectile.HEIGHT
_set_collision_size(attack_radius)
_debug_collision_shapes.init(get_children(), self, _collision_debug_material)
func _process(delta: float) -> void:
@@ -52,8 +49,6 @@ func _process(delta: float) -> void:
if _hit_window_timer > 0:
_hit_window_timer -= delta
elif _debug_collision_shapes.is_visible:
_debug_collision_shapes.set_visibility(false)
if _queue_hit_stop:
_queue_hit_stop = false
@@ -108,7 +103,6 @@ func attack() -> void:
_cooldown_timer = _cooldown_time
_hit_window_timer = _hit_window_time
_debug_collision_shapes.set_visibility(true)
side = Side.LEFT if side == Side.RIGHT else Side.RIGHT
attacked.emit()

View File

@@ -6,7 +6,6 @@ const MAX_STRETCH: float = 0.75
@export var _speed_stretch_factor: float = 100
@export var _collision_debug_material: Material
@export var _hit_particles_scene: PackedScene
@export var _destroy_particles_scene: PackedScene
@@ -21,12 +20,9 @@ var _size: float = 0.25
var _life_timer: float
var _debug_collision_shapes := DebugCollisionShapes.new()
func _ready() -> void:
_life_timer = _lifetime
_debug_collision_shapes.init(get_children(), self, _collision_debug_material)
global_position = _start_position
body_entered.connect(_on_body_entered)
_model_mesh.rotation = Vector3(

View File

@@ -32,17 +32,6 @@ var _current_prompts: CompressedTexture2D = _prompts_xbox
func _ready() -> void:
Input.joy_connection_changed.connect(_on_input_joy_connection_changed)
Debugger.add_event("mode_changed")
mode_changed.connect(
func(new_mode: Mode) -> void:
Debugger.event_emitted("mode_changed", [Mode.keys()[new_mode]])
)
Debugger.add_event("joy_connection_changed")
Input.joy_connection_changed.connect(
func(device: int, connected: bool) -> void:
Debugger.event_emitted("joy_connection_changed", [device, connected])
)
_get_controller_type()
@@ -59,9 +48,6 @@ func _input(event: InputEvent) -> void:
mode = Mode.KB_MOUSE
mode_changed.emit(mode)
if Debugger.show_debug() and event.is_pressed():
Debugger.text("input", _get_event_prompt_current_mode(event))
func get_vector_from_raw_strengths(
negative_x: float,