UNAVI Docs unavi.xyz
Build · Formats

.hsda: source

An .hsda file is the hand-written source of an HSD (Hyper-Space Document) document. It is written in RON (Rusty Object Notation), and compiles to an .hsdz package.

The format may change between releases.

Prims

A file is a list of prims. Each prim has attributes and a list of children, which are more prims.

The simplest example is a single prim with a script.

[
    (
        attributes: (
            name: "spawner",
            script: "./Cargo.toml",
        ),
        children: [],
    ),
]

Attributes

AttributeValue
nameA name, used to find the prim and to refer to it from other attributes
xformPosition, rotation, and scale
materialA standard PBR (physically based rendering) material
shaderA path to an .hss shader graph, used instead of material
imageAn image and how it is sampled
colliderA physics collider shape
rigid_bodyHow the prim moves in the physics simulation
gravity_scaleHow strongly gravity pulls on the prim
scriptA path to a script crate's Cargo.toml
referenceA path to another .hsda file, included as its own document
spawnA region, by radius, where people arrive in a space

Texture fields in a material name another prim by its name.

The default home space uses several of these together.

[
    (
        attributes: (
            name: "gate",
            reference: "../unavi-gate/asset.hsda",
            xform: (
                translation: [
                    0.0,
                    0.0,
                    -10.0,
                ],
            ),
        ),
        children: [],
    ),
    (
        attributes: (
            image: (
                data: "../../crates/unavi-app/assets/image/dev-white.png",
                address_mode_u: Repeat,
                address_mode_v: Repeat,
                address_mode_w: Repeat,
                mag_filter: Nearest,
                min_filter: Nearest,
                srgb: true,
            ),
            name: "ground_tex",
        ),
        children: [],
    ),
    (
        attributes: (
            material: (
                base_color_texture: "ground_tex",
            ),
            name: "ground",
        ),
        children: [],
    ),
    (
        attributes: (
            name: "unavi-default-home",
            script: "./Cargo.toml",
        ),
        children: [],
    ),
    (
        attributes: (
            name: "spawn",
            spawn: (
                radius: 4.0,
            ),
            xform: (
                translation: [
                    0.0,
                    0.5,
                    0.0,
                ],
            ),
        ),
        children: [],
    ),
]

Children

Children nest prims inside a parent. unavi-gate uses two named children as attachment points for its script to find.

asset.hsdahsd/unavi-gate
[
    (
        attributes: (
            name: "gate",
            script: "./Cargo.toml",
        ),
        children: [
            (
                attributes: (
                    name: "portal",
                    xform: (
                        translation: [
                            0.0,
                            1.3090171,
                            0.0,
                        ],
                    ),
                ),
                children: [],
            ),
            (
                attributes: (
                    name: "receptor",
                    xform: (
                        translation: [
                            -1.618034,
                            0.809017,
                            0.0,
                        ],
                    ),
                ),
                children: [],
            ),
        ],
    ),
]

Formatting

hsd format <file> rewrites a file in place, pretty-printed. Run hsd from the unavi workspace.