Whether a world-space point is on screen, for skipping animation work nobody sees.
The edges count as on screen, and margin grows the box by that many world units on
every side, for sprites whose bodies spill past their anchor point. Under a rotated
camera the checked box is the axis-aligned one around the turned viewport (the same
over-inclusive box TileMap.cull uses), so this can only ever animate too much, never
freeze something the player can see.
if (isOnScreen(camera, 160, 160)) console.log('the market square, animate it'); console.log(isOnScreen(camera, 10000, 10000, 32)); // far away, even with a margin
Whether a world-space point is on screen, for skipping animation work nobody sees.
The edges count as on screen, and
margingrows the box by that many world units on every side, for sprites whose bodies spill past their anchor point. Under a rotated camera the checked box is the axis-aligned one around the turned viewport (the same over-inclusive boxTileMap.culluses), so this can only ever animate too much, never freeze something the player can see.