3D engine that AI agents drive
JavaScript 3d3d-engineagentic-aiai-agentsblenderclaude-codegame-enginegaussian-splattinggltfjavascriptmcpmcp-servermodel-context-protocolpath-tracerpath-tracingpbrrenderingthreejs-alternativewebgl2webgpu
Merge remote-tracking branch 'origin/main' into 983-hinged-doors
Nguyen Xuan An1a1050c68ee1
diff --cc docs/vehicle.mdindex 9a5f15b5,fdd3251d..a5d48ab5--- a/docs/vehicle.md+++ b/docs/vehicle.md@@@ -222,11 -222,9 +222,11 @@@ In a recipe, a `dented` geometry does tThe source can be any geometry except a fragment or another dent. The vertex count stays the same.A part that comes off in a physics crash is a body joined to the car body by a `fixed` joint with `breakImpulse` ([breakable joints](physics.md#fracture-and-breakable-glue)); it breaks when a body takes a contact impulse over that number in one 1/60 s step.- For a drive, where nothing simulates the loose part, `detachedPartFlight(part, hit, { seed, gravity, groundY, restitution })` gives it a flight. `part` is `{ id, threshold, mass, position, size }`, with `size` the box of the part as three extents in metres (optional) and `hit` is `{ impulse, direction, point }` from `findDriveImpact` (`point` is optional and defaults to the part's centre); the part never crosses the plane through `point` with normal `direction`, which is the wall: with a `size`, no corner of its box (Euler angles in XYZ order) crosses it; without one, only the centre is held, so a long part can swing over the wall. It returns null when the impulse stays below `threshold`, so the part stays on. Otherwise `flight.sample(seconds)` (0 to 30 s) returns `{ position, rotation, velocity, settled }`: the part leaves mostly sideways at `(impulse - threshold) / (mass * 100)` m/s (at most 30) (a seeded sign, across `direction`, with a small rebound along `direction` and an up kick) and tumbles, falls, bounces on the plane `groundY` and comes to rest. The same inputs and `seed` give the same numbers. Set the node's transform from the sample each frame.+ For a drive, where nothing simulates the loose part, `detachedPartFlight(part, hit, { seed, gravity, groundY, restitution })` gives it a flight. `part` is `{ id, threshold, mass, position, size }`, with `size` the box of the part as three extents in metres (optional) and `hit` is `{ impulse, direction, point }` from `findDriveImpact` (`point` is optional and defaults to the part's centre); the part never crosses the plane through `point` with normal `direction`, which is the wall: with a `size`, no corner of its box (Euler angles in XYZ order) crosses it; without one, only the centre is held, so a long part can swing over the wall. It returns null when the impulse stays below `threshold`, so the part stays on. Otherwise `flight.sample(seconds)` (0 to 30 s) returns `{ position, rotation, velocity, settled }`: the part leaves mostly sideways at `(impulse - threshold) / (mass * 100)` m/s (at most 30) (a seeded sign, across `direction`, with a small rebound along `direction` and an up kick) and tumbles, falls, bounces on the ground plane `groundY` (the top of the ground, not the centre height) and comes to rest. With a `size` the lowest corner touches the ground, and at rest the box is snapped to lie on a face (the axis nearest vertical becomes vertical, the yaw is kept) with its lowest corner exactly on `groundY`; without a `size` the centre is held at `groundY` and the rotation is not snapped. The same inputs and `seed` give the same numbers. Set the node's transform from the sample each frame.-Not covered yet: hinged doors, hood and trunk that pop open, swapping broken glass for shards, and dents driven by the live vehicle controller. A drive is kinematic, so `findDriveImpact` only reports the moment of the hit; the car does not stop or bounce.+A door does not tear off: `hingedDoorSwing(part, hit, { hinge, maxAngle, damping, seed })` swings it open on its hinge. `part` and `hit` are as above, and `hinge` is `{ point, axis }`: a point on the hinge line (the line passes at least 1 mm from the door's centre) and its direction (any length but zero). It returns null when the impulse stays below `threshold`. Otherwise `swing.sample(seconds)` (0 to 30 s) returns `{ angle, angularVelocity, position, rotation, quaternion, settled }`: the door turns about the hinge line from the torque of the hit (`(impulse - threshold) / 100` along `direction`, at the lever from `hit.point` to the hinge, over the door's inertia, at most 15 rad/s), slows by `damping` (0 to 20, default 3) and dry friction, stops at `maxAngle` degrees (0 to 170, default 70) with a small bounce, and comes to rest. `angle` is in radians and its sign follows the hit; the frame stops the door from swinging back past shut. `position` is the door's centre and `rotation` (Euler XYZ, radians) or `quaternion` is its turn, so the hinge line stays where it is; set the node's transform from them each frame. A hit along the hinge line gives no torque, so the door stays shut. The same inputs and `seed` give the same numbers.++Not covered yet: hood and trunk that pop open, swapping broken glass for shards, and dents driven by the live vehicle controller. A drive is kinematic, so `findDriveImpact` only reports the moment of the hit; the car does not stop or bounce.## Limits