fix(asset-catalog): spawn后设置BlockAll碰撞使Line Trace生效

This commit is contained in:
2026-06-09 19:11:00 +08:00
parent d102c1b13a
commit 7d5a0657bb
+9
View File
@@ -398,6 +398,15 @@ def _try_trace_detail_boxes(mesh, bmin: tuple, bmax: tuple) -> tuple:
if not actor:
return [], ["trace_fail: spawn None"]
# Set collision to BlockAll so traces can hit this mesh
smc = actor.get_component_by_class(unreal.StaticMeshComponent)
if smc:
try:
smc.set_collision_enabled(unreal.CollisionEnabled.QUERY_AND_PHYSICS)
smc.set_collision_profile_name("BlockAll")
except Exception as e:
debug.append(f"collision_set_warn: {e}")
try:
hit_points = _perform_line_traces(actor, bmin, bmax)
debug.append(f"trace_hits: {len(hit_points)}")