3D draw help

Post here for help and support regarding LunaLua and SMBX2's libraries and features.

Moderator: Userbase Moderators

marioSuper21
Fighter Fly
Fighter Fly
Posts: 38
Joined: Thu Jul 31, 2025 8:43 am
Pronouns: he

3D draw help

Postby marioSuper21 » Mon Sep 01, 2025 6:22 pm

I wanted to learn how to draw a 3D object but I couldn't or nothing would happen.

Code: Select all

local lib3d = require("lib3d")

local model = lib3d.loadMesh(Misc.resolveFile("specific.obj"))

local image = Graphics.loadImageResolved("texture.png")
local material = lib3d.Material(nil, {texture = image}, nil, {UNLIT = true, TONEMAP = false, ALPHAMODE = lib3d.macro.ALPHA_DITHER})

function onDraw()
    local mesh = lib3d.Mesh{
        meshdata = model,
        material = material,

        scale = vector(64,64,64)*1,
        position = vector(camera.x + camera.width * 0.5, camera.y + 0.5 * camera.height * 0.5, 0),
    }
    
    mesh.active = true
end

Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 0 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari