soldier
<!-- zero:scaffolded-readme --> <!-- Replace the line below with what this module provides and who consumes it, then delete both comment lines. -->
soldier
<!-- zero:scaffolded-readme --> <!-- Replace the line below with what this module provides and who consumes it, then delete both comment lines. -->TODO: describe this module.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2game.enemy.soldier — one enemy soldier: how he is built, and how he moves. A soldier is a HIERARCHY OF NAMED JOINTS, not a model with an animation playing on it. Every bone is an entity whose rotation means something, so the walk, the aim, the reload and the fall are written here as the motion itself rather than swapped between states — which is what lets a soldier walk while turning while bringing his rifle up, instead of choosing one. Two things are worth knowing before reading it: ARMS ARE SOLVED, NOT POSED. The hands have to land on the weapon, and the weapon moves with the aim, so an arm written as three fixed angles is only ever correct for the one pose it was tuned in. `solveArm` does the two-bone triangle from the shoulder to the live grip point and aims both bones at the result, so the hands stay on the rifle through every yaw, every rise and every recoil impulse. THE BODY FACES ITS OWN -Z, the engine's forward. Everything here is built facing that way: the chest front, the toes, the rifle's muzzle. Units are metres, measured from the soles up. A soldier stands 1.80 m to the crown, with hips at 0.94, shoulders at 1.47 and a 0.28 m head.
mats( ) → void
Materials
box(parent: ?, name: ?, pos: ?, size: ?, mat: ?, rot: ?, mesh: ?) → void
Builders A box node: a joint with a primitive hung on it.
| arg | type | description |
|---|---|---|
| parent | ? | |
| name | ? | |
| pos | ? | |
| size | ? | |
| mat | ? | |
| rot | ? | |
| mesh | ? |
bone(parent: ?, name: ?, pos: ?, d: ?, len: ?, mat: ?, mesh: ?) → void
A bone: a joint whose limb runs DOWN its own -Y from the joint, so rotating the joint swings the whole limb from the right place. The mesh is offset half a length so a capsule grows away from the pivot rather than through it.
| arg | type | description |
|---|---|---|
| parent | ? | |
| name | ? | |
| pos | ? | |
| d | ? | |
| len | ? | |
| mat | ? | |
| mesh | ? |
aimBone(node: ?, dx: ?, dy: ?, dz: ?, hx: ?, hy: ?, hz: ?) → void
Point a bone's own -Y along a direction, with a hint deciding the roll. Written out rather than reusing `Transform.lookRotation`, which aims the -Z axis: a limb points down its length, not out of its face.
| arg | type | description |
|---|---|---|
| node | ? | |
| dx | ? | |
| dy | ? | |
| dz | ? | |
| hx | ? | |
| hy | ? | |
| hz | ? |
elbowAt(sx: ?, sy: ?, sz: ?, hx: ?, hy: ?, hz: ?, l1: ?, l2: ?, px: ?, py: ?, pz: ?) → void
Two-bone solve: where the elbow goes, given a shoulder, a hand and the bone lengths. The pole decides which way the joint bends, which is what separates an arm from a leg and an elbow from a knee.
| arg | type | description |
|---|---|---|
| sx | ? | |
| sy | ? | |
| sz | ? | |
| hx | ? | |
| hy | ? | |
| hz | ? | |
| l1 | ? | |
| l2 | ? | |
| px | ? | |
| py | ? | |
| pz | ? |
buildRifle(parent: ?, m: ?) → void
| arg | type | description |
|---|---|---|
| parent | ? | |
| m | ? |
build(parent: ?, opts: ?) → void
Building one soldier `opts` varies the figure without changing the silhouette: a different uniform, a shemagh or not, a helmet or a field cap, a height scale. The reference's kit list is the base and the variation rides on top of it.
| arg | type | description |
|---|---|---|
| parent | ? | |
| opts | ? |
arm(side: ?) → void
| arg | type | description |
|---|---|---|
| side | ? |
leg(side: ?) → void
| arg | type | description |
|---|---|---|
| side | ? |
gripPoints(s: ?) → void
Where the hands go The two grip points in the chest's own space — which is the space the shoulder and the rifle are both stated in, so the solve needs no conversion in between.
| arg | type | description |
|---|---|---|
| s | ? |
solveArm(arm: ?, target: ?, poleX: ?, poleY: ?, poleZ: ?) → void
Solve one arm onto a point in chest space and aim both bones at it.
| arg | type | description |
|---|---|---|
| arm | ? | |
| target | ? | |
| poleX | ? | |
| poleY | ? | |
| poleZ | ? |
pose(s: ?, dt: ?, t: ?) → void
Posing Drive every joint from the soldier's own animation state. Called every frame by the director.
| arg | type | description |
|---|---|---|
| s | ? | |
| dt | ? | |
| t | ? |
kill(s: ?, dirX: ?, dirZ: ?) → void
Death Fall. The direction is the way the shot came from, so a soldier drops away from what hit him rather than always folding the same way.
| arg | type | description |
|---|---|---|
| s | ? | |
| dirX | ? | |
| dirZ | ? |
isDead(s: ?) → void
| arg | type | description |
|---|---|---|
| s | ? |
flash(s: ?, zone: ?) → void
Hit feedback Tint the struck part, so a hit is legible at 60 m where the impact effect is only a few pixels.
| arg | type | description |
|---|---|---|
| s | ? | |
| zone | ? |
tickFlash(s: ?) → void
| arg | type | description |
|---|---|---|
| s | ? |
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.