add projectiles

This commit is contained in:
2025-02-18 02:28:33 +10:00
parent d53fe046a8
commit cd7bc7a82f
7 changed files with 137 additions and 9 deletions

View File

@@ -1,6 +1,8 @@
class_name DebugCollisionShapes
extends RefCounted
const MARGIN = 0.01
var _mesh_nodes: Array[MeshInstance3D] = []
@@ -21,32 +23,32 @@ func init(children: Array[Node], parent: Node, material: Material) -> void:
if shape_node.shape is CapsuleShape3D:
var shape := shape_node.shape as CapsuleShape3D
var mesh := CapsuleMesh.new()
mesh.radius = shape.radius
mesh.height = shape.height
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
mesh.height = shape.radius * 2
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
mesh.bottom_radius = shape.radius
mesh.height = shape.height
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 = false
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)