Put dead matadors on a corpse collision layer
A killed matador's ragdoll shared the WORLD layer with the bull, so the bull collided with the bodies and spazzed out on them. Give corpses a dedicated CORPSE layer masked to itself, and tag the ground/walls with CORPSE too (at level load, so it also reaches colliders baked into the instanced GLB arenas). The corpse still rests on the arena, but the bull — which only masks WORLD — passes straight through the bodies. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+15
-1
@@ -4,6 +4,8 @@ extends Node3D
|
||||
## spawners, lighting, colliders) into LevelRoot. Switching levels frees the whole
|
||||
## previous module first, so no old mesh or collider can survive into the next fight.
|
||||
|
||||
const PhysicsLayers = preload("res://physics_layers.gd")
|
||||
|
||||
@onready var _level_root: Node3D = $LevelRoot
|
||||
@onready var _camera: IsoCamera = $Player/Camera3D
|
||||
|
||||
@@ -25,4 +27,16 @@ func load_active_level() -> void:
|
||||
push_warning("game_shell: active level has no level_scene")
|
||||
return
|
||||
_camera.set_framing_scale(level.camera_zoom)
|
||||
_level_root.add_child(level.level_scene.instantiate())
|
||||
var module := level.level_scene.instantiate()
|
||||
_tag_environment_for_corpses(module)
|
||||
_level_root.add_child(module)
|
||||
|
||||
|
||||
## Ground and walls stay on WORLD so the bull and live matadors collide with them; here
|
||||
## we add CORPSE too. A killed matador's ragdoll is masked to CORPSE alone, so it rests
|
||||
## on the arena while the bull — which only collides with WORLD — passes through the body
|
||||
## instead of spazzing out on it. Done at load so it also reaches colliders baked into
|
||||
## the instanced GLB arenas, not just the level module's own floor box.
|
||||
func _tag_environment_for_corpses(module: Node) -> void:
|
||||
for body: StaticBody3D in module.find_children("*", "StaticBody3D", true, false):
|
||||
body.collision_layer |= PhysicsLayers.CORPSE
|
||||
|
||||
Reference in New Issue
Block a user