mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-13 02:52:01 +00:00
perf(physics): name and assign collision layers
Adds a [layer_names] section to project.godot (Ships/Ball/Arena/
GoalSensor) and sets collision_layer/collision_mask on the 4 physics
body roots (Ship, Ball, Goal Area3D, ArenaBoundary StaticBody3D),
which previously all sat on the default layer 1 / mask 1 so every
body broadphase-tested against every other.
Ships collide with ships/ball/arena but no longer test against the
goal sensor; the goal's mask (Ball only) is the physics-level fix for
what goal.gd's is_in_group("ball") check was doing defensively in
code (left in place, now a no-op guard). ArenaBoundary's runtime-
generated CollisionShape3D children inherit layer/mask from the
StaticBody3D root automatically.
Verified live via godot-mcp under Jolt Physics: ship-vs-ship and
ship-vs-ball collisions still transfer momentum, the ball still
bounces off arena walls, a ball entering a goal still fires
goal_scored (score updates / HUD reset), and a ship teleported into a
goal recess produces zero overlapping bodies on the goal Area3D (was
reachable before, physics-level fix confirmed, not just the code
guard). Headless smoke test (free_play.tscn) is clean.
This commit is contained in:
@@ -12,6 +12,8 @@ bounce = 0.15
|
||||
size = Vector3(1, 1, 4)
|
||||
|
||||
[node name="Ship" type="RigidBody3D"]
|
||||
collision_layer = 1
|
||||
collision_mask = 7
|
||||
mass = 5.0
|
||||
physics_material_override = SubResource("PhysicsMaterial_ship")
|
||||
inertia = Vector3(1, 1, 1)
|
||||
|
||||
Reference in New Issue
Block a user