Skip to content

Latest commit

 

History

History
80 lines (65 loc) · 3.72 KB

File metadata and controls

80 lines (65 loc) · 3.72 KB

Asset Authoring (Blender)

Three64 includes a Blender add‑on that lets you attach components to objects and bake a simple navmesh via an in‑Blender UI.

Tested Blender version: 4.3+ (see src/blender/README.md for details).

Install the Blender add‑on

File: src/blender/three64_blender_addon.py

  1. Open Blender → Edit → Preferences → Add‑ons.
  2. Click Install… and select three64_blender_addon.py.
  3. Enable “Three64 Component Data”.

Preferences (Edit → Preferences → Add‑ons → Three64 Component Data):

  • Component Data Directory: defaults to //component-data (relative to your .blend).
  • For this repo, point it at src/assets/default-component-data (generated by the build). Click “Reload Three64 Components” after changing JSONs or the folder.
  • Action Manifest: path to action-manifest.json (default //config/action-manifest.json) used by Events UI.

Important: Build the app locally first so the component presets exist:

npm run build
# or: npm run dev

Add components to objects (Object Properties)

  1. Select an object.
  2. Go to Object Properties → “Three64 Component” panel.
  3. Choose a component from the dropdown.
  4. Click “Add Selected Component”.
    • The object will show the component’s options as editable custom properties.
  5. Optional: The same controls appear in the default “Custom Properties” section for quick editing.
  6. Colors: When a parameter is a color, you’ll see a color picker and a hex field together.

Tip: You can edit any property value directly in Blender’s Custom Properties. Export with “Include → Custom Properties” enabled in glTF settings.

Events (Actions)

Object Properties → Three64 Component → “Events (Actions)”

  • Set string event emission:
    • Enter events.<key> (e.g., onCollision, onEnter) and an event name in “emit”, then click “Save”. The runtime will emit this string via EventSystem.
  • Add actions:
    • Pick an Action from the dropdown (sourced from the manifest), enter Params as JSON, and click “Add Action”. This appends an action object to the array stored at events.<key>.
    • Multiple actions are supported; each shows type and params with a remove button.

Example JSON stored on the object (visible in Custom Properties):

{
  "events.onCollision": [
    {
      "type": "ModifyStatistic",
      "params": { "name": "health", "op": "add", "value": -10, "target": "player" }
    },
    {
      "type": "SendComponentMessage",
      "params": { "target": "self", "component": "Rigidbody", "method": "zeroVelocity" }
    }
  ]
}

Notes:

  • The actions dropdown uses the path set in Preferences (default //config/action-manifest.json). If not found, a small built‑in set is available.
  • Values are stored on the object as custom properties under events.<key>: strings for emit mode or an array of action objects.

Exporting GLTF/GLB

Three64 prefers .glb:

  • File → Export → glTF 2.0 (.glb)
  • Recommended:
    • Include only needed collections
    • Apply transforms where appropriate
  • Save into src/assets/models/. The dev build copies the entire folder; production build tree‑shakes and optimizes models during copy (Draco if available).

Double‑Sided Rendering

  • Preferred (per material): In Blender Material → Settings, turn OFF “Backface Culling”. The exporter writes doubleSided=true to glTF.
  • Add-on per-object override: “Mark Double-Sided” sets doubleSided = True on the object (exported via extras). The runtime forces double-sided materials for meshes under that object.
  • Precedence:
    • Material doubleSided is respected.
    • Object doubleSided = True forces double-sided on its meshes.
    • Global default remains single‑sided for performance unless overridden.