Giad

WIP Library for creating walking vehicles

API / Library

Download (24 KB)

How do I install this?

There isn't much in the way of documentation, however test_entities.lua should provide a decent idea of how to use it if you're interested. The API is usable, but is open to revision.

Using the library

The library provides giad.meta and giad.leg. Use giad.meta as the metatable of your entity definition, and use giad.leg as the metatable for legs (the giad.leg.new constructor also works, but is very limited).

minetest.register_entity("giad:testbed", setmetatable({
    initial_properties = {
        visual = "mesh",
        mesh = "giad_testbed_body.obj",
    },
    textures = { "default_wood.png" },
    physical = true,

    _createLegs = function(self)
        --This function uses some for loops, but the gist is just to initialize the _legs table.
        local function newLeg(from, to)
            return setmetatable({
                offset = from,
                restPos = to,
                upper = "giad:leg_upper",
                lower = "giad:leg_lower",
                upperLength = 3,
                lowerLength = 4,
            }, giad.leg)
        end

        self._legs = {}

        for i = 1, 4 do
            local angle = vector.new(0, i * math.pi / 5, 0)
            self._legs[i * 2 - 1] = newLeg(vector.new(0, 0, 1):rotate(angle), vector.new(0, -3, 6):rotate(angle))
            self._legs[i * 2] = newLeg(vector.new(0, 0, 1):rotate(-angle), vector.new(0, -3, 6):rotate(-angle))
        end
    end,
    _maxStepping = 3,
    _canJump = true
}, giad.meta))

Reviews

Review

Do you recommend this mod?

  • No reviews, yet.