five-on-it / apps/client/src/renderer/dog-view
apps/client/src/renderer/dog-view
How a dog is drawn. The simulation runs the dogs (@foi/sim's dogs.ts: NPCs of their own, in the snapshots as characters of the role dog); here is only their look, pure maths from what a snapshot says of one (what it does, how fast it goes, whether it stands on the ground, whether it lies) to the pose of its model (models/companions.glb's dog: a body with its legs, head and tail at their joints, drawn through the batches with DrawOptions.limbs):
- The gait: its legs swing by the distance it covers, by diagonal pairs at a trot (the front left with the hind right), wider and longer at a run with the front pair and the hind pair nearly together (a gallop); its head nods with its stride and its tail wags, faster while it stands.
- The poses (DogPoseName): standing, trotting, running, its head down to
sniff, sitting (its rump down, its front legs straight under it, its hind legs folded forward, its head up), in theair(a hop: its legs stretched out) andlyingon its side (dead, or knocked down: its legs out, its head on the ground, no wag). A change of pose is blended over a few frames (DogLook). - The lead (Leads): a line from its walker's hand to its collar while the snapshot says it is on it, straight when the two are the lead's length apart and sagging the nearer they are (leadSag), down to the ground and no further.
Angles are in the limbs' own frames as the batches turn them: about a limb's x, a leg swings forward, the head goes up and the tail comes down for a positive turn.