Frame time on a big farm, round two: riding layer, instanced bundles
- Bundles on a belt move to a Riding layer that ignores the belts and the static world: every belt's catch trigger called OnTriggerStay (with a GetComponent) for each bundle riding it, every physics step. - Bundles draw as instanced batches from CargoTick (their own renderers off, one in someone's hands draws itself), not as 2000 renderers to cull, sort and draw in the view and every shadow cascade. - The main camera skips front-to-back sorting: the GPU has time to spare. - BeltNet.Belted and DronePad.Belted are cached until the build changes; splitters on the host look only at their own items. On the player's Mommy save, 2560x1440: base 14-15 ms -> 7.7 ms (~130 fps), meadow 11.5-12 ms -> 6.8-7.5 ms (~135-145 fps). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -219,7 +219,7 @@ namespace GrassCutter
|
||||
var cam = CameraFx.Cam ? CameraFx.Cam.transform : Me.head;
|
||||
var dir = cam.forward;
|
||||
float d = ahead;
|
||||
if (Physics.Raycast(cam.position, dir, out var hit, ahead + 0.5f, (1 << Layers.Default) | (1 << Layers.Build) | (1 << Layers.Prop), QueryTriggerInteraction.Ignore))
|
||||
if (Physics.Raycast(cam.position, dir, out var hit, ahead + 0.5f, (1 << Layers.Default) | (1 << Layers.Build) | Layers.CargoMask, QueryTriggerInteraction.Ignore))
|
||||
d = Mathf.Max(0.6f, hit.distance - 0.6f);
|
||||
var p = cam.position + dir * d;
|
||||
float above = Vector3.Dot(p - Me.transform.position, Me.transform.up);
|
||||
|
||||
Reference in New Issue
Block a user