Skip to content

fix(person): keep clothing layers apart and draw a hoodie as one - #77

Merged
anistark merged 1 commit into
mainfrom
feat/person-layers
Nov 15, 2026
Merged

anistark merged 1 commit into
mainfrom
feat/person-layers

Conversation

@anistark

Copy link
Copy Markdown
Contributor

No clothing layer passes through another, as a rule of Person itself, for every outfit and style.

  • drape(outer, under, unit) in person/sdf.ts: wherever a layer under a garment comes within 3 mm of its surface, or through it, the garment sits 3 mm over it
  • Only where the garment is there at all, so hems, necklines, sleeve ends and open fronts still show what is under them
  • Coverage is read 3 cm in from the inner surface and level with it, since hems are level cuts and a vertical look would see past them
  • Inner layers are read from a 1 cm lattice, which keeps a figure's build about 14% slower than before
  • Across eight outfits on two bodies and two builds, vertices of a layer showing through the one over it went from 69,476 to 2,913, most of the rest where they should show (a shirt in an open jacket's front) or inside the body

A hoodie reads as one

  • Its hood, down, is a fuller rim round the neck and a soft heap on the upper back, and a pouch with slanted openings stands across the belly
  • Both are painted a fold shade of the hoodie's color (foldOf), since flat two-tone shading shows no edge where cloth lies on cloth
  • Before, the jeans' seat came through the back as two dark ovals, and the hood was a thin roll

Belts go where they're worn

  • Most villager presets wear a belt, so every hoodie and jacket had one round it
  • A belt now goes on the bottoms under a top that hangs over the waist, and over only a tunic, coat, dress or robe (BELTED_OVER in person/spec.ts)

Known gaps, not fixed here

  • Collars (a hood is one) are not draped: a jacket over a hoodie would have the hood heap come through its back. No outfit does that yet
  • Every top's neckline is cut as a cylinder down the whole garment, which hollows a long top between the legs under its hem, out of sight

Testing: just check passes, with new tests for drape (lifts where it covers, leaves a hem open, changes nothing elsewhere) and the belt order. Viewed a hoodie front and back in the docs gallery preview (stylized) and in a downstream world (punk).

- No clothing layer passes through the one over it, while hems, necklines, sleeve ends and open fronts still show what is under them
- A hoodie has its hood lying on the upper back and a pouch across the belly, each a fold shade of its color
- A `belt` accessory goes under a hoodie or a jacket instead of round it, and stays over a tunic, coat, dress or robe

[CONTRIBUTORS]
- `drape(outer, under, unit)` in `person/sdf.ts` lifts a garment 3 mm over each layer under it wherever it covers that layer
- `shapeFigure` drapes every layer over the ones before it, reading them from a 1 cm `lattice`
- `BELTED_OVER` in `person/spec.ts` decides where a belt goes in the stack
- Tests for `drape` and the belt order, the `Person` JSDoc and `CHANGELOG.md` updated, registry regenerated
@anistark
anistark merged commit d9a86be into main Nov 15, 2026
1 check passed
@anistark
anistark deleted the feat/person-layers branch November 15, 2026 08:14
anistark added a commit that referenced this pull request Nov 15, 2026
**`Terrain` gains `shore`, a beach an avatar can walk up out of the
sea.** A small island's bare coast is close to a cliff: on the
workshop's "Island cove" it runs 30° to 66°, which testing the swimming
in #76 showed an avatar can't climb.
- `shore` is the width, in units, of a band past the land's edge where
the ground falls 2 units at one slope, from 0.4 above the world ground
to wading depth, then drops to the deep as before
- So the beach is as gentle as it is wide: `shore: 6` is about 18°, and
about 4.3 is the 25° mark
- Land near the coast is lowered to meet the beach, so nothing steeper
stands behind it
- With a shore, `flatRadius` flattens the land alone (scaling the sea
bed would steepen it), and a pad wider than the land pushes the beach
out to its edge
- The island grows outward by `shore`, so it needs room inside `size`

**Worlds without `shore` keep every height they had**
- The old path in `terrainHeight()` is untouched, and `shore` is read
only on an island (one with `falloff`)
- A test pins four shore-less shapes with `toBe` against heights
recorded from `main` before the change

**"Island cove" template**
- Its terrain takes `shore: 6`: the steepest stretch between +0.3 m and
-1.5 m on the collider mesh goes from 60.8° to 19.6°
- `Dock` moves from `[0, 0, 19]` to `[0, 0, 9.4]` and the `Sailboat`
from z 24 to z 15.5. The dock used to start 9 m out from the waterline
over 7 m of water, and now starts on the sand
- The campfire, rocks and person stay at height 0, and the palms move by
1 to 4 mm

**Also**
- `shore` slider range in the workshop, regenerated `registry/` and
component docs
- `person.md` picks up two prop descriptions from #77 that were not
regenerated there

Known limit: on a coarse grid (cells much wider than about 1.5 m) the
crease at the bottom of the beach can show one steep triangle, 31° at
`resolution: 32` on an 80 x 60 terrain.

Testing: `just check` passes. In the workshop, a `Player` holding W
walks from 1.6 m deep onto land in 2.5 s with `shore: 6`; on the old
coast it slides to the bottom.

Refs #76
anistark added a commit that referenced this pull request Nov 15, 2026
…es (#79)

**`Pool`'s exit steps can be walked**, the stock `Player` climbs from
the basin floor onto the deck and back down
- The three 0.4 m blocks and the 0.47 m last rise stalled the avatar,
which floats 0.3 m over the ground
- The flight is now 0.25 m risers counted down from the coping, as many
as `depth` needs, under one `ConvexHullCollider` wedge
- The `steps` prop is unchanged

**`Pool`'s basin walls are solid**
- They were drawn without colliders, so an avatar on the basin floor
walked out through them and fell
- One `CuboidCollider` per wall, the size of its mesh

**`Player` keeps its pace on a slope whichever way it walks**
- ecctrl only turns its slope ray to the direction of travel under
`autoBalance`, which `Player` turns off, so the ray stayed in front of
the camera
- `SlopeRay` in `packages/components/src/Player.tsx` turns it to follow
the avatar's velocity; ecctrl is not patched
- Backing down a 32° ramp goes 2.2 m/s (was 0.6), across it 2.5 (was
0.9), stairs backwards 1.7 down and 1.5 up (were 1.1 and 0.9); forward
and flat-ground speeds are unchanged
- Strafing straight up or down a slope now matches walking up or down it
(2.0 and 2.2 m/s) instead of flat-ground speed

**Also in the diff**
- `apps/docs/src/content/docs/components/person.md` is regenerated: two
`Person` prop descriptions changed in #77 without the page being rebuilt

Testing: `just check` passes. Walked in the workshop with the stock
`Player`: pool floor to deck and back, all four walls of the default
pool and a `depth: 2.4` pool, and W/S/A/D on a 32° ramp, a `Staircase`
and flat ground, in first and third person. Gamepad and touch joystick
were not driven.

Refs #76 (also edits `Player.tsx` and `Pool.tsx`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant