Add ANY component to a saved R3 project
r3_component_addAdd one component of ANY registered type — a collider, a rigid body, a joint, a light, a material, a geometry … — to a saved R3 project, with its values and references set before it is created. Kept at once in the project's live copy: every R3 tab with the project open shows it now, no editor needed and nothing to save (r3_editor_add_component is the same tool). Use r3_factory_run for a ready-made object (a cube, a physics sphere …).
type is the short type name, e.g. "ColliderCuboid" (an unknown type is refused with the list). values take r3_component_set's shapes: a plain value {"friction": 0.2}; a value component as the keys to set {"halfExtents": {"x": 2, "y": 0.5, "z": 1}}; a reference as the target's entityRef or id {"rigidBody": "rigidbody_dynamic_1"} — a component of THIS project, of a type the slot accepts; "name" names it (a name already used is kept as its label, and its entityRef gets a suffix, e.g. hull_2: the answer says so); "entity" puts it in an Entity (its value components join too). A type that cannot exist without an option (an Audio / AudioPositional / Texture's "url") takes it in values too, and is refused without it. A Code component's code is r3_code_write's. A VehicleWheel added with a mesh is measured from it (Configure from Mesh: radius, connectionPoint, axle), and a ColliderCuboid / Sphere / Cylinder / Capsule with a mesh (its own or its rigid body's) is fitted to it (Fit to Mesh: size, and position on the mesh's centre), only the values you did not pass; the answer says what (PHYSICS_USAGE.md → Vehicles).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"projectId": "<projectId>",
"type": "<type>"
},
"name": "r3_component_add"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | The component type, e.g. "ColliderCuboid", "RigidBodyFixed", "LightPoint". | |
| values | No | Its values, e.g. {"rigidBody": "rigidbody_dynamic_1", "halfExtents": {"x": 2}, "friction": 0.2}. | |
| projectId | Yes | The project to add to (r3_project_list). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seq | No | ||
| type | Yes | ||
| saved | Yes | ||
| answer | Yes | This answer in words: what was done, what R3 measured, decided or refused, and what to do next. The same text as the result's text block. Read it: the fields beside it are the data, this is the guidance. | |
| created | Yes | ||
| physics | Yes | ||
| entityRef | Yes | ||
| projectId | Yes | ||
| componentId | Yes |