Object Types
All MC3 object elements with their attributes. Common attributes (name, position, rotation, scale, pivot, material, visible, collision, tags) apply to all types.
<box> / <cube>
Rectangular box centered at the origin.
<box name="Wall" size="10 4 0.3" position="0 2 -5" material="brick"/>
| Attribute | Type | Default | Description |
|---|---|---|---|
size | vec3 | 1 1 1 | Width × Height × Depth |
segments | int | 1 | Subdivisions per axis |
<sphere>
<sphere name="Ball" radius="0.5" segments="24" position="0 1 0"/>
| Attribute | Type | Default | Description |
|---|---|---|---|
radius | float | 0.5 | Sphere radius |
segments | int | 16 | Latitude/longitude subdivisions |
<cylinder>
<cylinder name="Pillar" radius="0.3" height="4" segments="16"/>
| Attribute | Type | Default | Description |
|---|---|---|---|
radius | float | 0.5 | Base radius |
height | float | 1.0 | Total height |
segments | int | 16 | Circumference subdivisions |
axis | x|y|z | y | Cylinder axis |
<cone>
<cone name="Cap" radius="0.5" height="1.5" segments="16"/>
| Attribute | Type | Default |
|---|---|---|
radius | float | 0.5 |
height | float | 1.0 |
segments | int | 16 |
<plane>
Flat surface with no thickness.
<plane name="Ground" size="50 50" axis="y" material="grass"/>
| Attribute | Type | Default | Description |
|---|---|---|---|
size | vec2 | 1 1 | Width and height |
axis | x|y|z | y | Normal axis |
segments | int | 1 | Subdivisions |
<mesh>
External polygon mesh loaded from an OBJ file.
<mesh name="Chair" src="assets/chair.obj" material="wood"/>
src: path relative to the .mc3.xml file. Currently only OBJ files are supported in the viewport; other formats may be silently ignored.
<extrude>
Sweeps a 2D cross-section along a 3D path, producing a solid mesh with optional end caps and twist.
The <extrude> element contains exactly two child elements: <cross_section> and <path>.
Top-level extrude attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
segments | int | 32 | Number of subdivisions along the path |
twist | float | 0.0 | Degrees of rotation applied cumulatively from start to end of path |
smooth | bool | true | Smooth (averaged) normals vs. flat face normals |
caps | bool | true | Close both ends of the swept tube with filled polygons |
Cross-section types (<cross_section type="…">)
| type | Specific attributes | Common | Description |
|---|---|---|---|
rect | width (default 0.3), height (default 0.3) | segments | Rectangular tube. Combine with inner_radius= (not in current header — omit) for hollow effect using Difference CSG instead. |
circle | radius (default 0.1), inner_radius (default 0 → solid; >0 → hollow pipe) | segments | Circular tube or hollow pipe. inner_radius > 0 generates a ring cross-section. |
polygon | radius (circumradius), sides (default 6) | segments | Regular N-gon cross-section. sides=3 → triangle, sides=6 → hexagon, etc. |
custom | child <point x="…" y="…"/> elements (CCW winding) | — | Arbitrary closed 2D polygon defined as a list of 2D points. |
Path types (<path type="…">)
| type | Specific attributes | Description |
|---|---|---|
line | length (default 1.0), axis (default "y") | Straight extrusion along the given world axis. Axis is "x", "y", or "z". |
arc | radius (default 1.0), angle in degrees (default 180) | Circular arc in the XZ plane. Use to create arches, curved rails, rings. |
helix | radius (default 0.5), height (default 2.0), turns (default 4) | Helical spiral — useful for springs and screws. |
polyline | child <point x="…" y="…" z="…"/> elements | Piecewise-linear 3D path through an ordered list of points. |
bezier | child <point x="…" y="…" z="…" cx="…" cy="…" cz="…"/> elements | Cubic Bézier spline. Each point carries an optional in-control cx/cy/cz offset used to compute the smooth tangent. |
Complete examples (5 × 4 combinations)
Arch — rect cross-section on arc path
<extrude name="Arch" segments="24" caps="true">
<cross_section type="rect" width="0.3" height="0.2"/>
<path type="arc" radius="2.0" angle="180"/>
</extrude>
Pipe — hollow circle on helix path
<extrude name="Spring" segments="64">
<cross_section type="circle" radius="0.08" inner_radius="0.04"/>
<path type="helix" radius="0.5" height="2.0" turns="6"/>
</extrude>
Hex beam — polygon cross-section on line path
<extrude name="HexBeam" segments="1">
<cross_section type="polygon" radius="0.15" sides="6"/>
<path type="line" length="3.0" axis="y"/>
</extrude>
Star — custom cross-section on polyline path
<extrude name="StarTrack" segments="4">
<cross_section type="custom">
<point x="0" y="0.3"/>
<point x="0.1" y="0.1"/>
<point x="0.3" y="0"/>
<point x="0.1" y="-0.1"/>
<point x="0" y="-0.3"/>
<point x="-0.1" y="-0.1"/>
<point x="-0.3" y="0"/>
<point x="-0.1" y="0.1"/>
</cross_section>
<path type="polyline">
<point x="0" y="0" z="0"/>
<point x="2" y="1" z="0"/>
<point x="4" y="0" z="0"/>
</path>
</extrude>
Twisted ribbon — rect cross-section on Bézier path with twist
<extrude name="Ribbon" segments="32" twist="180">
<cross_section type="rect" width="0.5" height="0.05"/>
<path type="bezier">
<point x="0" y="0" z="0" cx="1" cy="1" cz="0"/>
<point x="3" y="2" z="1" cx="1" cy="0" cz="0"/>
<point x="6" y="0" z="0"/>
</path>
</extrude>
<group>
Container. Applies a shared transform to its children. Children can be any type (including nested groups).
<group name="House" position="10 0 0">
<box name="Walls" …/>
<box name="Roof" …/>
</group>
<instance>
Places a copy of a <definition>. Supports material override.
<instance name="Tree1" definition="tree" position="-5 0 3"/>
<instance name="Tree2" definition="tree" material="autumn_leaves"/>
<union> / <difference> / <intersection>
CSG boolean operations. See CSG Tutorial for examples.
<difference name="ArchHole" material="stone">
<box name="block" size="2 2 2"/>
<sphere name="cavity" radius="0.8" role="cutter"/>
</difference>
<area>
Invisible logical zone (collision/trigger/pathfinding). No visual representation in the viewport.
<area name="TriggerZone" size="5 3 5" tags="trigger checkpoint"/>