Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

3D interface

edited August 2014 in Code Sharing Posts: 167

A little program to show off some of Codea's 3d compatibilites, whipped it up in like 10-15 mins, lol hope you like it!



  • Posts: 167

    About 30 lines of code for this cool program, hah! Who knew?

    -- 3D UI
    function setup()
        parameter.integer("CamX", 0, 3000)
        parameter.integer("CamY", 0, 3000)
        parameter.integer("CamZ", 0, 3000, 1400)
        parameter.integer("LAX", -1000, 3000, 420)
        parameter.integer("LAY", -1000, 3000, 0)
        parameter.integer("LAZ", 0, 3000)
        b = vec3(0, 0,500)
    function draw()
        background(93, 93, 93, 255)
    camera(CamX, CamY, CamZ, LAX, LAY, LAZ)
    fill(255, 255, 255, 255)
    rect(300, 300, 2000, 100)
    local h = 20 + math.sin(ElapsedTime) * 10
    fill(106, 68, 31, 255)
    rect(300, 300, 100, 50)
    sprite("Planet Cute:Character Boy", b.x, b.y)
    b.x = b.x + 1
    b.y = b.y + 1
    --Coomented out, you can put it back in and he will go farther out
    --b.z = b.z + 1
  • edited August 2014 Posts: 1,976

    Um, what's it supposed to do? You call it an interface/UI, but it's just some rectangles and a boy moving around for me. (An interface has buttons and stuff...?)

    Also, try looking into meshes before you do 3D. Using sprite() and rect() and all that stuff lags pretty bad and was designed for 2D graphics.

  • IgnatzIgnatz Mod
    Posts: 5,396

    that's ok, we all have to start somewhere ;)

  • Posts: 167

    Ok, I will replace the 2D designed images to a 3D mesh, I just might need a little help turning the rectangle from "rect()" into a mesh for 3D... Or I could try other shapes... I'm also finished with a mesh in there for a 3D triangle with a function 'math.sin(ElapsedTime) * 60' with the triangle's Z axis (tri.z), so now the top will act like an airplane rudder... As in: tri.vertices = {vec3(0,0,0), vec3(100,0,0), vec3(50,100,h)}

Sign In or Register to comment.