From ffbac06e0a74a2b56340dfa451566d7642db4ba3 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sat, 25 Apr 2026 18:22:08 +0200 Subject: [PATCH] Refactor: Use local collider variable in RuntimeHost --- src/runtime-three/runtime-host.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/runtime-three/runtime-host.ts b/src/runtime-three/runtime-host.ts index 3a5378c5..a51df443 100644 --- a/src/runtime-three/runtime-host.ts +++ b/src/runtime-three/runtime-host.ts @@ -5620,13 +5620,14 @@ export class RuntimeHost { if (npc !== null) { switch (npc.collider.mode) { case "capsule": { + const collider = npc.collider; const sampleClearance = Math.max( - npc.collider.radius, + collider.radius, TARGETING_VISIBILITY_TARGET_CLEARANCE ) + TARGETING_VISIBILITY_TARGET_CLEARANCE_PADDING; const yAt = (factor: number) => - npc.position.y + npc.collider.height * factor; + npc.position.y + collider.height * factor; return [ { @@ -5645,18 +5646,19 @@ export class RuntimeHost { ]; } case "box": { + const collider = npc.collider; const sampleClearance = clampScalar( Math.max( - npc.collider.size.x, - npc.collider.size.y, - npc.collider.size.z + collider.size.x, + collider.size.y, + collider.size.z ) * 0.25, 0.35, 0.75 ) + TARGETING_VISIBILITY_TARGET_CLEARANCE_PADDING; const yAt = (factor: number) => - npc.position.y + npc.collider.size.y * factor; + npc.position.y + collider.size.y * factor; return [ {