gizgame/mount
Universal mount and vehicle projectile stepping with real target and terrain hit detection.
import * as Mount from "gizgame/mount";Types
MountShot
type MountShot = { pos: Point3; vel: Point3; life: f64; kind: string; damage: i64; radius: f64; }An active projectile fired from a mount or vehicle.
pos:gizlang_geometry.Point3vel:gizlang_geometry.Point3life:f64kind:stringdamage:i64radius:f64
ShotTarget
type ShotTarget = { id: i64; pos: Point3; radius: f64; }A targetable entity in world space.
id:i64pos:gizlang_geometry.Point3radius:f64
ShotHit
type ShotHit = { targetId: i64; pos: Point3; damage: i64; kind: string; }A confirmed projectile hit on a target.
targetId:i64pos:gizlang_geometry.Point3damage:i64kind:string
ShotStep
type ShotStep = { shots: Vec<MountShot>; hits: Vec<ShotHit>; groundHits: Vec<Point3>; }Result of stepping all active mount projectiles by dt.
shots:Vec<M233.MountShot>hits:Vec<M233.ShotHit>groundHits:Vec<gizlang_geometry.Point3>
Functions
fireMountShot
function fireMountShot(origin: Point3, dirX: f64, dirZ: f64, pitch: f64, speed: f64, kind: string, damage: i64 = 25, radius: f64 = 1.6, life: f64 = 1.8): MountShotConstructs a projectile fired from origin along forward (dirX, dirZ) and pitch angle.
Effects: fail.
stepMountShots
function stepMountShots(shots: Vec<MountShot>, targets: Vec<ShotTarget>, dt: f64, groundY: (x: f64, z: f64) => f64): ShotStepAdvances mount projectiles and detects hits against targets and ground height.
Effects: fail, read, write, console, io, alloc.