Atomontage Documentation

website·Indexed 31 days ago

https://atomontagedocs.netlify.app/

Developer documentation and API reference for Atomontage, featuring Lua scripting guides, editor basics, and a comprehensive API for 3D vectors (Vec2, Vec3, Vec4), transforms, voxel data, and server/client management.

Tokens
29.1K
Snippets
189
Records
285
Agent score
75%

What's inside Atomontage

  1. Overview of Atom Montage API bindings

    The Atom Montage API bindings are currently in a testing stage and subject to change. Beyond the documented bindings, additional global functions (e.g., util:schedule() or events.keyDown.addListener()) are defined by other Lua scripts. Developers can discover these functions in VSCode by right-clicking a function and selecting 'Go to Definition'.
  2. Introduction to Atomontage Editor and Scripting

    Atomontage provides an editor and a scripting system using Lua bindings. Scripting is currently in closed early access.
  3. Understand the Hit object returned by raycasts

    When performing raycasts (as detailed in the Collision API), the system returns a Hit object containing spatial and material data about the intersection point. This object is available on both the Client and Server.
    interface Hit {
      pos: Vec3;      // The position of the hit
      normal: Vec3;   // The surface normal at the hit point
      color: Vec3;    // The color of the hit surface
      object: Object;  // The object that was hit
      distance: number; // The distance from the ray origin to the hit point
      material: string; // The material of the hit surface
      type: HitType;    // The type of hit recorded
    }
  4. Understand the Properties object returned by Overlap functions

    The Properties object is returned by Overlap() functions (found in the Collision API). It provides spatial and identity data about the overlapping entity, available on both Client and Server environments.
    interface Properties {
      center: Vec3;
      radius: number;
      object: Object;
      shape: Shape;
    }
  5. Understand the Component base class inheritance

    In Atom Montage, all components (including Transform, Script, Camera, VoxelData, StaticVoxelData, VoxelRenderer, MeshData, MeshRenderer, and Sky) inherit from the base Component class. This class is designed as a base for inheritance and is not intended to be instantiated directly.
  6. Specify geometry update frequency with ResourceUsage

    Use the ResourceUsage enum to provide hints to OpenGL or Vulkan drivers about how often geometry data is modified. This allows the driver to optimize memory placement based on the expected update frequency:

    • Static: Geometry is changed once.
    • Dynamic: Geometry is changed more often.
    • Stream: Geometry is changed every frame.
  7. Understand StaticVoxelData constraints

    In the Atom Montage API, every scene contains exactly one instance of static voxel data. Static voxel data is specifically used for the world and cannot be moved. In contrast, a scene can contain multiple dynamic voxel data instances.
  8. Understand the Shape base class

    The Shape class is the base class for all geometric shapes used for voxel edits, collisions, and rendering. It is not intended to be instantiated directly. Derived shape classes include Box, Sphere, Capsule, Cylinder, Polygon, and Polyhedron.
  9. Create a Vec3 instance

    The Vec3 class represents 3D vectors and points. It provides a wide variety of constructors to initialize vectors using numbers, integers, or other vector types (Vec2, Vec2i, Vec3, Vec3i, Vec4, Vec4i).
    // Basic initialization
    const v1 = new Vec3();
    const v2 = new Vec3(1, 2, 3);
    
    // Initialization from other vector types
    const v3 = new Vec3(vec2, 5);
    const v4 = new Vec3(5, vec2);
    const v5 = new Vec3(otherVec3);
  10. Print debug messages to the Lua console

    Use the print() function to output values to the Lua console. The most recent print appears in the bottom left corner of the screen. You can print single values, tables, or multiple comma-separated values.
    -- Print a simple string
    print("hello world")
    
    -- Print a table
    local table = {"hello", "world", self.object}
    print(table)
    
    -- Print multiple values
    print(self.object.name, "children:", self.object.children)