Log inGet started
Package

slicer.module

Newest version

README.md

game.enemies.slicer

Cuts closed procedural meshes along planes and caps the cut, so the katana leaves clean pieces. Used by CrewDirector when a katana kills a fruit thug, and again when a lying piece is slashed.

  • S.cut(parts, n, p) → neg, pos: split a solid (a list of { mat, geo } parts in one frame) by the plane through p with unit normal n. Crossed triangles are split with interpolated normals and UVs; the cut edges of all parts are welded by position and chained into loops, and every closed loop gets a cap on both pieces.
  • S.cutAll(parts, { {n, p}, ... }) → every piece after cutting by each plane.
  • S.bounds(parts) → centre, half extents, triangle count.
  • S.CUT maps a flesh material to the cut-face material that shows its cross-section (tomato → cut_tomato, ...). Loops through flesh cap with it, UV-mapped to the loop's bounds so the texture's round slice fills the section; other loops (eyes, buckles) cap in their own material 1.5 mm inward.