import type { BodyHandle, PhysicsBackend, PhysicsVec3 } from "./physicsBackend.js"; /** Options for {@link createVehicleBackendLink}. */ export interface VehicleBackendLinkOptions { /** Chassis collision box half extents, m (width/2, height/2, length/2), heading along +z. */ halfExtents: PhysicsVec3; /** Gap kept between the box bottom and the car's base height, so the cast never scrapes the ground (default `0.1`). */ clearance?: number; /** Collision layer bitmask of the chassis body (default `1`). */ layers?: number; /** Layers the chassis body collides with and shoves in the solver (default all). */ mask?: number; /** Layers that stop the car in `clampMove` (default all). Leave props off it so the car shoves them instead of stopping. */ blockMask?: number; /** Contact normals steeper than this `y` count as ground, not walls, and never block (default `0.7`). */ groundNormalY?: number; } /** The pose fields {@link VehicleBackendLink.sync} reads; any vehicle step (`VehicleDynamicsStep`, `KinematicVehicleStep`) fits. */ export interface VehicleLinkPose { position: readonly [number, number, number]; heading: number; bodyPitch?: number; bodyRoll?: number; } /** A wall the last clamped move ran into. */ export interface VehicleLinkHit { body: BodyHandle; normal: PhysicsVec3; /** Metres of this move the wall absorbed; divide by `dt` for the impact speed. */ blocked: number; } /** A vehicle sim's presence in a physics backend: a kinematic chassis that shoves props, and a wall-aware move clamp. */ export interface VehicleBackendLink { readonly body: BodyHandle; /** Pass as the sim's `clampMove` option: sweeps the chassis box and stops at walls, sliding along them. */ clampMove(from: readonly [number, number], to: readonly [number, number]): readonly [number, number]; /** Move the kinematic chassis to the sim's pose; call after each sim tick, before the backend steps. */ sync(pose: VehicleLinkPose): void; /** The wall the most recent `clampMove` hit, or `null`. */ lastHit(): VehicleLinkHit | null; dispose(): void; } /** * Puts a vehicle sim (`createVehicleDynamics`, `createKinematicVehicle`) into a {@link PhysicsBackend} world without * handing its handling to the rigid-body solver: the sim still owns grip and balance, while a kinematic chassis box * follows it so Rapier or `PhysicsWorld` props get shoved, and `clampMove` sweeps that box so walls and parked cars * stop it and it slides along them. * @capability vehicle-backend-link collide a vehicle sim with a physics backend — shove props, stop at walls, slide along them */ export declare function createVehicleBackendLink(backend: PhysicsBackend, options: VehicleBackendLinkOptions): VehicleBackendLink;