surfaces
The table of driving surfaces and the per-wheel lookup. Fourteen surfaces in a fixed order (tarmac, wetTarmac, concrete, cobbles, gravel, dirt, mud, grass, sand, snow, ice, rumble, puddle, oil; the index is the driving contract's `car.surfaceId`), each with grip, slide grip, stif…
surfaces (driveSurfaces.surfaces)
The table of driving surfaces and the per-wheel lookup. Fourteen surfaces in a fixed order (tarmac, wetTarmac, concrete, cobbles, gravel, dirt, mud, grass, sand, snow, ice, rumble, puddle, oil; the index is the driving contract's car.surfaceId), each with grip, slide grip, stiffness, rolling resistance, bogging drag, roughness, dust colour, skid sound, tyre class and the material it wears. sample(hitEntityId, position) answers the surface under a wheel contact: a SurfacePatch zone there first, else the Surface component on the hit entity or its nearest ancestor, else tarmac, cached per entity id so it costs about 0.25 µs. Also names, list, get, byId, ofEntity, patchAt, material, and authoring helpers paint(entity, kind), pad(kind, position, opts), patch(kind, position, opts) and gallery(parent). Called by torqueCars' cars per wheel per physics tick, and by anything that wants to know the ground (skid sounds, dust, AI caution).
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2strict
tarmac( ) → void
wetTarmac( ) → void
concrete( ) → void
cobbles( ) → void
gravel( ) → void
dirt( ) → void
mud( ) → void
grass( ) → void
sand( ) → void
snow( ) → void
ice( ) → void
rumble( ) → void
puddle( ) → void
oil( ) → void
names( ) → void
Surface names in their fixed order (the `car.surfaceId` order).
list( ) → void
Every surface definition, in order.
get(name: string) → Surface
The definition of one surface by name, or nil.
| arg | type | description |
|---|---|---|
| name | string |
byId(id: number) → Surface
The definition at `car.surfaceId` index `id`, or nil.
| arg | type | description |
|---|---|---|
| id | number |
default( ) → Surface
The default surface (tarmac).
material(name: string) → any
The material a surface wears, as an AssetRef for a Model's `material` field.
| arg | type | description |
|---|---|---|
| name | string |
comp(v: any, i: number) → number
Read component `i` (1 x, 2 y, 3 z, 4 w) of a vector or a { x, y, z } / { [1], [2], [3] } table.
| arg | type | description |
|---|---|---|
| v | any | |
| i | number |
registerPatch(key: string, kind: string, center: any, rot: any, half: any, pad: number?) → void
Register or move a patch zone. `center` and `half` are vectors or {x,y,z} tables; `rot` is the zone's world rotation quaternion {x,y,z,w}, `half` its half extents in metres. `pad` (default 0.35 m) widens it vertically so a wheel contact a little above or below the zone's flat box still counts.
| arg | type | description |
|---|---|---|
| key | string | |
| kind | string | |
| center | any | |
| rot | any | |
| half | any | |
| pad | number? |
unregisterPatch(key: string) → void
| arg | type | description |
|---|---|---|
| key | string |
patchCount( ) → number
The patch zones currently registered (read-only view, for debugging).
patchAt(x: number, y: number, z: number) → Surface
| arg | type | description |
|---|---|---|
| x | number | |
| y | number | |
| z | number |
patchAt(position: any) → Surface
The patch surface at a world point, or nil.
| arg | type | description |
|---|---|---|
| position | any |
invalidate( ) → void
Forget cached entity lookups (Surface components call this when they appear, change or go).
lookup(id: string) → Surface
| arg | type | description |
|---|---|---|
| id | string |
ofEntity(target: any) → Surface
The surface of an entity (its own Surface component or its nearest ancestor's), else tarmac.
| arg | type | description |
|---|---|---|
| target | any |
sample(hitEntityId: any, position: any) → Surface
The surface at a wheel's contact: a patch zone at `position` first, else the Surface component on `hitEntityId` or its nearest ancestor that has one, else tarmac. `hitEntityId` may be an id string, an entity proxy or nil; `position` a vector, a position proxy or {x, y, z}.
| arg | type | description |
|---|---|---|
| hitEntityId | any | |
| position | any |
paint(target: any, kind: string) → any
Authoring helpers. Give an entity a surface: its Model wears the surface's material (a cube Model is added if it has none) and it carries a `Surface` component of that kind, so wheels feel it.
| arg | type | description |
|---|---|---|
| target | any | |
| kind | string |
pad(kind: string, position: any, opts: { [string]: any }?) → any
Spawn a drivable surface pad: a box `size` = {x, y, z} metres (default 8 x 0.2 x 8) whose top sits at `position`'s y, wearing the surface, with a static box collider and a Surface component. `opts.parent`, `opts.name`, `opts.synced`, `opts.yaw` (degrees).
| arg | type | description |
|---|---|---|
| kind | string | |
| position | any | |
| opts | { [string]: any }? |
patch(kind: string, position: any, opts: { [string]: any }?) → any
Spawn a patch zone (puddle, oil, rumble strip or any surface) lying on the ground at `position`: `size` = {x, z} metres (default 4 x 4). The patch draws its own look.
| arg | type | description |
|---|---|---|
| kind | string | |
| position | any | |
| opts | { [string]: any }? |
gallery(parent: any?) → any
Lay out every surface as a labelled 6 x 6 m pad with a concrete border, two rows of seven, 9 m apart (puddle, oil and rumble lie as patches on tarmac pads). Returns the root.
| arg | type | description |
|---|---|---|
| parent | any? |
Surface = {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.