[PERF] LegCorrector: 6 raycasts per frame in LateUpdate #13

Closed
opened 2026-03-12 00:02:46 +00:00 by lavarius · 0 comments
Owner

🟠 High — Performance

File: LegCorrector.cs

6 raycasts per frame (3 per leg × 2 legs) in LateUpdate adds significant CPU overhead, especially noticeable on lower-end hardware.

Fix:

  • Throttle to every N frames (e.g. every 2-3 frames): if (Time.frameCount % 3 != 0) return;
  • Or reduce raycast max distance
  • Cache Vector3[] allocations to avoid per-frame GC pressure
## 🟠 High — Performance **File:** `LegCorrector.cs` 6 raycasts per frame (3 per leg × 2 legs) in `LateUpdate` adds significant CPU overhead, especially noticeable on lower-end hardware. **Fix:** - Throttle to every N frames (e.g. every 2-3 frames): `if (Time.frameCount % 3 != 0) return;` - Or reduce raycast max distance - Cache `Vector3[]` allocations to avoid per-frame GC pressure
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lavarius/ProjectOverlay#13
No description provided.