3D draw help
Posted: 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