Fix delayed FPS collapse from dense imp collision recovery and repeated routing

This commit is contained in:
JariKo
2026-10-29 13:16:22 +02:00
parent e031595dc4
commit f4a01058d6
15 changed files with 257 additions and 21 deletions
+6 -1
View File
@@ -168,11 +168,16 @@ func bake_repeated(root,locations):
var n=queue.pop_back()
for child in n.get_children():queue.append(child)
if n is CollisionShape3D:
# Bokeh rooms need solid silhouettes, not triangle-level ornament contact.
# Convex pieces avoid expensive capsule recovery when an imp gets stuck.
var collision=n.shape
var source_mesh=n.get_parent().get_parent()
if source_mesh is MeshInstance3D:collision=source_mesh.mesh.create_convex_shape(true,true)
for location in locations:
if absf(location.y)>.1 or absf(location.z)>20.1 or location.x< -22.1 or location.x>40.1:continue
var body=StaticBody3D.new();body.collision_layer=2;body.collision_mask=0;g.add_child(body)
var tr=n.global_transform;tr.origin+=location;body.transform=tr
var shape=CollisionShape3D.new();shape.shape=n.shape;body.add_child(shape)
var shape=CollisionShape3D.new();shape.shape=collision;body.add_child(shape)
if not n is MeshInstance3D or not n.visible:continue
var mm=MultiMesh.new();mm.transform_format=MultiMesh.TRANSFORM_3D;mm.mesh=n.mesh;mm.instance_count=locations.size()
for i in range(locations.size()):