Log inGet started
World

Hullbreaker

Branchmain
Branchesmain
Commitcdbe4bf730

README.md

game/cutting

The maths behind the plasma torch. Everything here is pure, or a read of the live scene — no state lives in this module, because a module local does not survive a hot-reload and the torch keeps its state in component fields.

local CUT = require("game.cutting")

CUT.basis(qx, qy, qz, qw)      right / up / forward of a rotation
CUT.aim(cameraEntity)          where the helmet is and which way it looks
CUT.index()                    the salvage plates and their welds
CUT.pick(ox,oy,oz, dx,dy,dz, range, coneCos, index)
                               the weld the beam is on, if any
CUT.heatStep(heat, locked, lockTimer, wantsCut, onNode, dt, cfg)
                               one tick of the heat / lockout model
CUT.hotColor(t)                the one ramp everything warm agrees on

pick is a cone rather than a ray: the torch is aimed by a helmet in six degrees of freedom, so it forgives a few degrees instead of demanding a cursor on a pixel. It skips welds already burnt through, so the first weld you cut does not stand in front of the two still holding the plate on.