Appearance
Developer notes — kids.kapish.splines.walls
unity
Shape
A wall is a closed cross-section extruded along a spline, so the heavy lifting is kids.kapish.splines.meshes' StripMeshBuilder. This package is thin: parametric WallProfile presets + a component that computes the strip, sweeps it, and emits collision.
- Profiles are
StripProfilesubclasses withClosed => true. Across (0→1) spans the wall thickness (the strip's Left↔Right, =StripSettings.Width); Up is metres. Solid = rectangle; Hedge chamfers the top; Fence adds a pointed cap. v1 presets are convex, soStripMeshBuilder's fan caps are valid. - Thickness is
StripSettings.Width; conform rides the strip'sConformToTerrain, so the base follows the ground. Height is constant (v1) — on the profile. - Collision is separate. Per-section
BoxColliders walk the strip centre atColliderSegmentLength, each sizedthickness × ColliderHeight × segment, oriented along the segment, riding from the strip surface up. Deliberately ignores footing/top shaping — it only has to stop you walking through. (Convex-mesh colliders could replace these later for odd profiles.) - Non-destructive: additive baked mesh assets + GameObjects under
Generated Wall; no terrain mutation, so walls don't take part in the flatten/drop bake — they justRebuild()(they'reIBakeable).
Known gaps (v1)
- Joins — wall↔wall and hedge↔wall meeting aren't reconciled (no shared-end cap suppression / mitre yet). Mirror the path junction work when needed.
- Winding —
StripMeshBuilderaligns winding to a computed outward normal, but if a profile reads inside-out,FlipFacesis the escape hatch. - Smoothing — flat per-face normals; hedges/rounded copings will want smooth normals later.
- Height — constant; per-knot / curve-driven height is a later option.
File Structure
Runtime/
├── WallProfile.cs # WallProfile + Solid/Hedge/Fence presets
├── WallMeshStrip.cs # component: sweep + box colliders (IBakeable)
└── Carrot.Splines.Walls.asmdef
Editor/
├── WallMeshStripEditor.cs
└── Carrot.Splines.Walls.Editor.asmdefUsage Guide
Build a wall
- Add a
SplineContainerand draw the wall line. - Add a WallMeshStrip (Add Component → Carrot/Splines/Wall Mesh Strip).
- Pick a Profile (Solid / Hedge / Fence) and set its Height.
- Set Strip Settings → Width to the wall thickness, and turn on ConformToTerrain so the base hugs the ground.
- Assign a Material and hit Rebuild.
csharp
using Carrot.Splines; // StripSettings
using Carrot.Splines.Walls;
using UnityEngine;
var wall = gameObject.AddComponent<WallMeshStrip>();
wall.StripSettings.Width = 0.5f; // thickness
wall.StripSettings.ConformToTerrain = true; // base follows the ground
wall.Profile = new HedgeProfile { Height = 1.6f, TopChamfer = 0.3f };
wall.Material = hedgeMaterial;
wall.Rebuild();Notes
- Collision is on by default — simple box colliders per
ColliderSegmentLengthmetres, independent of the visual mesh. Turn offGenerateCollidersif you don't need it. - Inside-out? Toggle Flip Faces and rebuild.
- Profiles are swappable presets; a fence is a thin wall with a pointed cap, a hedge is a chamfered-top wall. Width (thickness) lives in Strip Settings, height on the profile.
- Joins between walls (and a hedge coming off a wall) aren't reconciled yet — for now keep meeting walls as separate strips; mitred joins are coming.