Docs/Format/Object Types

Common Object Attributes

Every object element supports these attributes:

AttributeTypeDefaultDescription
namestringObject name. Required for animation targets and interactive action references.
positionvec30 0 0World position (X Y Z).
rotationvec30 0 0Euler rotation in degrees, applied XYZ order.
scalevec31 1 1Scale per axis.
pivotvec30 0 0Rotation/scale pivot offset in local space. Essential for doors, lids, and levers.
materialIDREFReference to a material id declared in <materials>.
visiblebooleantrueWhether the object is rendered.
collisionstringnonePhysics collision type: none, static, dynamic, kinematic, trigger.
tagsstringSpace-separated tag list (e.g., "door interactive wood").
rolestringcutter — marks this object as a subtractor inside a <difference> CSG node.
layerstringNamed layer for visibility grouping. Empty means the default layer.
statestringInitial active state name (must match an id in the object's <states> block).

Transform order: T(position + pivot) × R(rotation) × S(scale) × T(−pivot)

Object Child Elements (all types)

The following optional child elements may appear inside any object element, in this order:

<states> — named configurations

Declares named configurations that override the object's base attributes at runtime.

<box name="Door" state="closed">
  <states>
    <state id="closed" rotation="0 0 0"/>
    <state id="open"   rotation="0 90 0"/>
  </states>
</box>

See Interactive Actions & States for the full reference.

<deform> — geometry-level scale

Applied before the object transform. Useful for non-uniform stretching of a primitive without affecting its children's transforms.

<sphere name="Egg" radius="0.5">
  <deform scale="1.0 1.5 1.0"/>
</sphere>

The deform.x/y/z components are also animatable via keyframe channels (see Animation Reference).

<uv_mapping> — texture coordinate control

Controls how the texture is tiled and positioned on the object surface.

<box name="Wall" size="10 3 0.3" material="brick">
  <uv_mapping scale="2.5 1.5" offset="0 0" rotation="0"/>
</box>
AttributeTypeDefaultDescription
scalevec21 1U and V scale (tiling factor).
offsetvec20 0U and V offset.
rotationfloat0Rotation in degrees.

<metadata> — import source data

Opaque key-value store preserved during round-trip serialization. Intended for tool-specific import/export hints that should not affect rendering.

<box name="ImportedWall">
  <metadata>
    <property name="rd4_original_type" value="SweepObject"/>
    <property name="rd4_source_line"   value="142"/>
  </metadata>
</box>

Primitive Objects

<box> / <cube>

Rectangular box centered at the local origin. <cube size="n"> is equivalent to <box size="n n n">.

<box name="Wall" size="10 4 0.3" position="0 2 -5" material="brick"/>
<cube name="Crate" size="1" material="wood"/>
AttributeTypeDefaultDescription
sizevec31 1 1Width × Height × Depth. For <cube>, a single number is expanded to W H D.
segmentsint1Subdivisions per axis.

<sphere>

<sphere name="Ball" radius="0.5" segments="24" position="0 1 0"/>
AttributeTypeDefaultDescription
radiusfloat0.5Sphere radius.
segmentsint16Latitude/longitude subdivisions.

<cylinder>

<cylinder name="Pillar" radius="0.3" height="4" segments="16" axis="y"/>
AttributeTypeDefaultDescription
radiusfloat0.5Base radius.
heightfloat1.0Total height.
segmentsint16Circumference subdivisions.
axisx|y|zyHeight axis. Controls how the mesh is generated; does not apply a rotation transform.

<cone>

<cone name="Cap" radius="0.5" height="1.5" segments="16"/>
AttributeTypeDefault
radiusfloat0.5
heightfloat1.0
segmentsint16

<plane>

Flat surface with no thickness. Useful for floors, ground planes, and walls with one-sided rendering.

<plane name="Ground" size="50 50" axis="y" material="grass"/>
AttributeTypeDefaultDescription
sizevec21 1Width and height.
axisx|y|zyNormal axis.
segmentsint1Subdivisions.

<torus>

Donut-shaped surface. Useful for rings, wheels, and loop shapes.

<torus name="Ring" major_radius="1.0" minor_radius="0.25" segments="32"/>
AttributeTypeDefaultDescription
major_radiusfloat1.0Distance from the center of the tube to the center of the torus.
minor_radiusfloat0.25Radius of the tube.
segmentsint32Ring subdivisions (both major and minor).

<capsule>

Cylinder with hemispherical end caps. Commonly used as a character or physics body shape.

<capsule name="Body" radius="0.4" height="1.8" segments="16"/>
AttributeTypeDefaultDescription
radiusfloat0.5Radius of the cylinder and the end caps.
heightfloat1.0Total height including both caps.
segmentsint16Circumference subdivisions.

<disk>

Circular disc (or annulus when inner_radius > 0). Use for coin shapes, rings, and washers.

<disk name="Coin"   radius="0.4" segments="32"/>
<disk name="Washer" radius="0.5" inner_radius="0.2" segments="24"/>
AttributeTypeDefaultDescription
radiusfloat0.5Outer radius.
inner_radiusfloat0Inner hole radius. 0 = solid disc.
segmentsint24Circumference subdivisions.

<grid>

Flat subdivided plane (N×M quads) useful as a ground or reference surface. Unlike <plane>, a grid has configurable subdivision for deformation or displacement.

<grid name="Ground" size="10 10" subdivisions_x="10" subdivisions_z="10"/>
AttributeTypeDefaultDescription
sizevec21 1Width × depth (X × Z).
subdivisions_xint1Number of columns.
subdivisions_zint1Number of rows.

<icosphere>

Sphere with uniformly distributed triangles (no pole singularity). Higher subdivision gives a rounder result with fewer shading artifacts than a UV sphere at the same polygon count.

<icosphere name="Ball" radius="0.5" subdivisions="3"/>
AttributeTypeDefaultDescription
radiusfloat0.5Sphere radius.
subdivisionsint3Refinement iterations. Each step ×4 triangles: 0=20, 1=80, 2=320, 3=1280 faces.

<mesh>

External polygon mesh loaded from a file. Supports OBJ and GLB/glTF sources.

<mesh name="Chair" src="assets/chair.obj" material="wood"/>
AttributeDescription
srcPath to the mesh file, relative to the .mc3.xml file. OBJ files are previewed in the editor viewport (up to ~300k triangles); GLB/glTF references are parsed at export time.

<extrude>

Sweeps a 2D cross-section along a 3D path, producing a solid mesh with optional end caps and twist. Contains exactly two child elements: <cross_section> and <path>.

<extrude name="Arch" material="stone"
          segments="24" caps="true" smooth="true">
  <cross_section type="rect" width="0.3" height="0.2"/>
  <path type="arc" radius="2.0" angle="180"/>
</extrude>

Extrude attributes

AttributeTypeDefaultDescription
segmentsint32Subdivisions along the path.
twistfloat0.0Total rotation in degrees applied from start to end of path.
smoothbooltrueSmooth (averaged) normals between segments vs. flat face normals.
capsbooltrueClose both ends of the swept tube with filled polygons.

Cross-section types

typeAttributesDescription
rectwidth, heightRectangle.
circleradius, inner_radius (optional), segmentsCircle or hollow pipe. inner_radius > 0 → annular cross-section.
polygonradius (circumradius), sidesRegular N-gon. sides=3→triangle, sides=6→hexagon.
customchild <point x="…" y="…"/> elements (CCW winding)Arbitrary closed 2D polygon.

Path types

typeAttributesDescription
linelength, axis (x|y|z)Straight extrusion along a world axis.
arcradius, angle (degrees)Circular arc in the XZ plane. Good for arches and curved rails.
helixradius, height, turnsHelical coil. Good for springs and screws.
polylinechild <point x y z/>Piecewise-linear 3D path.
bezierchild <point x y z cx cy cz/>Cubic Bézier spline; cx/cy/cz is the in-tangent control point.

Examples

<!-- Arch -->
<extrude name="Arch" segments="24">
  <cross_section type="rect" width="0.3" height="0.2"/>
  <path type="arc" radius="2.0" angle="180"/>
</extrude>

<!-- Spring -->
<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 bolt -->
<extrude name="HexBeam" segments="1">
  <cross_section type="polygon" radius="0.15" sides="6"/>
  <path type="line" length="3.0" axis="y"/>
</extrude>

<!-- Twisted ribbon -->
<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 that applies a shared transform to its children. Children can be any type including nested groups.

<group name="Table" position="3 0 1">
  <box name="Top"  size="2 0.1 1"     position="0 1 0"      material="wood"/>
  <box name="Leg1" size="0.08 1 0.08" position="-0.9 0.5 -0.4" material="wood"/>
  <box name="Leg2" size="0.08 1 0.08" position=" 0.9 0.5 -0.4" material="wood"/>
  <box name="Leg3" size="0.08 1 0.08" position="-0.9 0.5  0.4" material="wood"/>
  <box name="Leg4" size="0.08 1 0.08" position=" 0.9 0.5  0.4" material="wood"/>
</group>

Transform hierarchy: world_transform = parent_transform × local_transform

<instance>

Places a copy of a <definition> in the scene. Shares the definition's geometry but supports per-instance overrides.

<instance name="Tree1" definition="tree" position="-5 0 3"/>
<instance name="Tree2" definition="tree" position=" 5 0 1" material="autumn_leaves"
          scale="1.2 1.2 1.2"/>

Overridable attributes on <instance>: position, rotation, scale, material, visible, collision, state. Tags are merged with definition tags.

<union> / <difference> / <intersection>

CSG Boolean operations. See CSG Tutorial for detailed examples.

<!-- Difference: box with spherical cavity -->
<difference name="HollowBox" material="stone">
  <box    name="body"   size="2 2 2"/>
  <sphere name="cavity" radius="0.9" role="cutter"/>
</difference>

<!-- Union: merge two shapes -->
<union name="TwoSpheres" material="glass">
  <sphere radius="0.6" position="-0.4 0 0"/>
  <sphere radius="0.6" position=" 0.4 0 0"/>
</union>

<!-- Intersection: only the overlapping volume -->
<intersection name="RoundBlock" material="metal">
  <box    size="1.5 1.5 1.5"/>
  <sphere radius="0.9"/>
</intersection>

CSG children can themselves be CSG operations (recursive). The role="cutter" attribute applies only inside <difference>; all children of <union> and <intersection> participate equally.

CSG evaluation uses the Manifold v3 library and requires non-degenerate, watertight meshes. Results are cached per object and invalidated on every edit.

<area>

An invisible logical volume for trigger zones, checkpoints, and pathfinding hints. No visual geometry is generated.

<area name="CheckpointZone"
      size="5 3 5"
      position="0 1.5 10"
      tags="trigger checkpoint"/>
AttributeTypeDefaultDescription
sizevec31 1 1Box extent of the area volume.
tagsstringUse tags to classify areas (e.g., "trigger", "checkpoint", "navmesh").

Areas are typically paired with on_enter_area triggers in interactive actions. See Interactive Actions.

Pivots and Rotation Centers

The pivot attribute shifts the rotation and scale center away from the object's local origin. This is essential for doors (pivot on the hinge edge), lids (pivot at the back edge), levers, and wheels.

<!-- Door that rotates around its left edge -->
<box name="Door"
     size="1 2.1 0.08"
     position="0 1.05 0"
     pivot="-0.5 0 0"
     material="wood"/>

Transform order with pivot: T(position + pivot) × R(rotation) × S(scale) × T(−pivot)

The pivot is in local object coordinates, specified before any transform is applied.