dismember3dplugin
Limbs that come off a Mixamo body when shot, thrown off as pieces.
Putting it in a scene
List it after anim, box3d and particle3d, and before render3d. A body that comes apart is a row of a kind world.dismember3d.kinds lists, a Mixamo body drawn by anim whose rig carries the ends anim's bake measures. Its prefab holds off: [] and hp: {}, and its hit act hands what struck it to hit. A shot meets its joints when world.hitscan3d.mods.bodies names dismember3d. A limb comes off as a row of a piece kind: the scene's sim lists each of the seven piece kinds, skull, arm, forearm, hand, thigh, shin and foot, each has a prefab and an entry in world.box3d.kinds, the shape it tumbles as, lying along its own y, and none has a look of its own.
"plugins": ["loader", "scenemanager", "player", "terrain3d", "box3d", "anim", "particle3d", "dismember3d", "render3d"],
"world": {
"dismember3d": {
"kinds": { "zombie": { "gore": { "sever": "bloodBurst", "drip": "bloodDrip" } } },
"mods": { "land": "terrain3d" }
},
"hitscan3d": { "mods": { "ground": "terrain3d", "bodies": "dismember3d" }, "kinds": { "zombie": { "off": "limp" } }, "rewind": 12 },
"box3d": {
"subStepCount": 4, "static": [],
"kinds": {
"skull": { "shapes": [{ "sphere": { "center": [0, 0, 0], "radius": 0.11 }, "density": 1000 }] },
"arm": { "shapes": [{ "capsule": { "center1": [0, -0.3, 0], "center2": [0, 0.3, 0], "radius": 0.05 }, "density": 1000 }] },
…
}
}
},
"prefabs": {
"zombie": { "off": [], "hp": {}, "limp": false },
"skull": { "pos": [0, 0, 0], "rot": [0, 0, 0, 1], "vel": [0, 0, 0], "spin": [0, 0, 0], "awake": true },
…
}
Properties
Read from world.dismember3d.
.kinds : { [kind]: { gore?: { sever?, drip? } } }
The kinds of body that come apart. gore names the particle3d effects a kind's pieces burst in where they come off, sever, thrown the way the piece flies, and drip as they lie, drip, carried with the piece for as long as it lies. A kind that names no gore, or a scene that lists no particle3d, has none.
.mods : { bodies?, land? }
The other bodies a shot meets, and the ground the gore comes to rest on (see Mods).
The limbs
The limbs are a Mixamo body's segments, each named by the bone it starts at. A shot meets each in a sphere, its joint, where the segment starts: the shoulder for an upper arm, the elbow for a forearm, the wrist for a hand, the hip, the knee and the ankle for the legs, and the middle of the head. Each hit on a joint takes its damage off the joint's hp, and at none the segment comes off, with the segments it carries. A piece is thrown at its push, in m/s in the body's frame (x its left, y up, z ahead), beside the body's own velocity, and spins at its spin, in radians a second about the body's axes.
| Segment | Piece | Goes with it | Joint radius, metres | hp | Push | Spin |
|---|---|---|---|---|---|---|
head | skull | 0.13 | 1 | [0.3, 2.5, −1.2] | [4, 1, 2] | |
armL | arm | forearmL, handL | 0.08 | 1 | [0.8, 0.5, −0.3] | [2, 0.5, 4] |
forearmL | forearm | handL | 0.07 | 1 | [0.8, 0.5, −0.3] | [2, 0.5, 4] |
handL | hand | 0.06 | 1 | [0.8, 0.6, −0.3] | [3, 1, 5] | |
uplegL | thigh | legL, footL | 0.11 | 1 | [0.6, 0.3, −0.4] | [1, 0.3, 2] |
legL | shin | footL | 0.09 | 1 | [0.6, 0.3, −0.4] | [1, 0.3, 2] |
footL | foot | 0.07 | 1 | [0.5, 0.4, −0.5] | [2, 0.5, 3] |
The right side's segments, armR to footR, are the left's with the push's x and the spin's y and z turned the other way. Losing the head kills the body: it stops where it stands and dies by ragdoll3d's die, its blow 1.5 m/s backwards, 1.4 metres above its pos. Losing a thigh or a shin puts the body's rig to crawl from that step.
The page draws a body without the limbs it has lost, a finger counting as the hand's, and draws each piece as its limbs fixed in the pose the body stood in the frame the piece is first drawn, carried wherever box3d puts its row until the row ends.
The rows
| Row | Fields dismember3d writes |
|---|---|
| A body | off, the segments it has lost. hp, each joint's hits left, filled the first time a joint is hit. rig, "crawl" once a leg is lost. ragdoll3d's dying row, through die, when the head is lost. |
| A piece | box3d's pos, rot, vel, spin and awake. of, the id of the body it came off. limbs, the segments it carries. |
Methods
From #plugins/dismember3d/dismember3d.sim.ts.
hit( w, me, struck )
Takes a hit on the joint of the segment struck.part names, a hitscan3d Struck as the body's hit act is handed it. The joint loses struck.damage of its hp, and at none the segment comes off as lose takes it. A limp body, a part that is null or names no segment, and a segment already lost take nothing.
lose( w, me, limb )
Cuts a segment off, with every segment it carries that is still on. They all go on off, and one row of the segment's piece kind is spawned carrying them, from the top of the segment lost to the end of the lowest one going with it, standing at their middle and turned along them, as they stand this step. It is thrown at the push plus the body's velocity, spinning at the spin, both turned by the body's yaw. Then the body crawls or dies as the table above says. A limp body, a segment already lost, and a body that has played no clip yet, as one spawned this step, lose nothing.
joints( w, me ) : { segment, at, radius }[]
Every joint of a body whose segment it still has, at in the world as it stands this step of its clip. None for a body anim has played no clip on yet.
pieces( w, body ) : Row[]
Every piece row cut off a body. A body's rule ends them when it clears the body away.
Properties of the plugin
Also from #plugins/dismember3d/dismember3d.sim.ts.
LIMBS : { [segment]: { piece, below, joint, push, spin, kills?, crawls?, fall? } }
The table above. below is what goes with it, joint is { radius, hp, about? } with about marking a joint at the segment's middle, and fall is the blow of a segment that kills, { dir: [x, z], speed, height } in the body's frame.
PIECES : string[]
Every piece kind, once.
Mods
Name them in world.dismember3d.mods.
- terrain3d
land:land(plugins)is the land as the page has it,{ height(x, z) }, or undefined until its field has loaded. The gore comes to rest on it under where a piece came off. With none named, or none yet, it rests at y 0. Alandnamed for a plugin the scene does not list fails.
bodies is a server function, (w) → { id, kind, pos, shapes }[]: the other bodies dismember3d's mod for hitscan3d hands on beside its own. It is read from the named plugin's mod for dismember3d, and no module ships one, so it is a game's own plugin's.
dismember3d gives one mod.
- hitscan3d
bodies: name it inworld.hitscan3d.modsas{ bodies: "dismember3d" }. Every row of a kindworld.dismember3d.kindslists is itsjoints, each a sphere with its part named as its segment, so a shot'spartis the segment it hit. Every other body comes from thebodiesmodworld.dismember3d.modsnames, none when it names none, and a body that mod hands with the id of one of these is this one, never both.