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
+9 -2
View File
@@ -23,7 +23,9 @@ func build(root):
if bounds.size.length()<.24:continue
var body=StaticBody3D.new();body.name="MeshWalkingCollider";body.collision_layer=2;body.collision_mask=0
mesh.add_child(body)
var collider=CollisionShape3D.new();collider.shape=mesh.mesh.create_trimesh_shape();body.add_child(collider)
var collider=CollisionShape3D.new()
collider.shape=mesh.get_meta("walk_collision_shape") if mesh.has_meta("walk_collision_shape") else mesh.mesh.create_trimesh_shape()
body.add_child(collider)
collider.shape.backface_collision=true
func rebuild(stations):
outlines.clear()
@@ -44,7 +46,12 @@ func blocked(point,radius=.32):
if point.distance_to(Geometry2D.get_closest_point_to_segment(point,polygon[i],polygon[i+1]))<radius:return true
return false
func move_actor(node,motion,radius=.30,height=1.65):
shape.radius=radius;shape.height=maxf(height,2*radius);shape_node.position.y=(.195 if height>1.4 else .10)+height/2
if motion.length_squared()<.0000001:return
if not is_equal_approx(shape.radius,radius):shape.radius=radius
var capsule_height=maxf(height,2*radius)
if not is_equal_approx(shape.height,capsule_height):shape.height=capsule_height
var offset=(.195 if height>1.4 else .10)+height/2
if not is_equal_approx(shape_node.position.y,offset):shape_node.position.y=offset
probe.position=node.position;probe.force_update_transform()
var remaining=motion
for i in range(4):