anyone already design a triangle/pyramide-block?

User avatar
tkerwel
Member
 
Posts: 213
Joined: Fri Jan 13, 2012 07:35

anyone already design a triangle/pyramide-block?

by tkerwel » Tue Jul 10, 2012 11:09

i would be interested in the code, so if somebody knows a mod with has a block with a trianlge or a pyramide , it would be nice to give a link to this mod here.

thanks in advance
++++ Kung walang tiyaga, walang nilaga. ++++
 

jin_xi
Member
 
Posts: 165
Joined: Mon Jul 02, 2012 18:19

by jin_xi » Tue Jul 10, 2012 14:31

this little snippet makes half height pyramids.

create mymod folder in mods/minetest, save in there as init.lua

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_craft( {
    output = 'mymod:pyramid 4',
    recipe = {
        { 'default:tree', '', ''},
        { 'default:tree', 'default:tree', '' },
        { 'default:tree', 'default:tree', 'default:tree' },
    }
})

minetest.register_node("mymod:pyramid", {
    description = 'pyramid',   
    tiles = { "default_tree.png" },
    drawtype = "nodebox",
    sunlight_propagates = true,
    paramtype = 'light',
    node_box = {
        type = "fixed",
        fixed = {
            {-0.50, -0.50, -0.50,   0.50, -0.45,  0.50},       
            {-0.45, -0.45, -0.45,   0.45, -0.40,  0.45},
            {-0.40, -0.40, -0.40,   0.40, -0.35,  0.40},
            {-0.35, -0.35, -0.35,   0.35, -0.30,  0.35},
            {-0.30, -0.30, -0.30,   0.30, -0.25,  0.30},
            {-0.25, -0.25, -0.25,   0.25, -0.20,  0.25},
            {-0.20, -0.20, -0.20,   0.20, -0.15,  0.20},
            {-0.15, -0.15, -0.15,   0.15, -0.10,  0.15},
            {-0.10, -0.10, -0.10,   0.10, -0.05,  0.10},
            {-0.05, -0.05, -0.05,   0.05, -0.00,  0.05},
        },
    },
    selection_box = {
        type = "fixed",
        fixed =  {-0.5, -0.5, -0.5, 0.5, 0.0, 0.5},
    },
    groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}
})


Last edited by jin_xi on Tue Jul 10, 2012 14:34, edited 1 time in total.
 

jin_xi
Member
 
Posts: 165
Joined: Mon Jul 02, 2012 18:19

by jin_xi » Tue Jul 10, 2012 14:46

its kind of neat, but i think this one could easily be built upon: the "lego" mod...
would need upside down pyramid, slope, prism and all those small bits and pieces...

anyone already got some functions to help with defining all these repetitive crafts and nodes?
 

User avatar
tkerwel
Member
 
Posts: 213
Joined: Fri Jan 13, 2012 07:35

by tkerwel » Tue Jul 10, 2012 14:55

thx...

thats what i was thinking abt, slopes, prism etc.... but when somebody is arleady working on this, i dont have to invent the wheel again....

@jin_xi
will try this snippet tomorrow, maybe i can put this idea into my tree projekt as top of trees..

thx again
++++ Kung walang tiyaga, walang nilaga. ++++
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

by Jeija » Tue Jul 10, 2012 15:00

I have been working on this quite a while ago:
Irregular 3D Objects

That mod creates the nodeboxes in several for-loops which makes it easy to define different detail levels and make other structures from scratch.
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
tkerwel
Member
 
Posts: 213
Joined: Fri Jan 13, 2012 07:35

by tkerwel » Wed Jul 11, 2012 06:38

UPDATE:

looks like its a question aof the detail level... if i change this form 100 to 50 its running.

local slopebox = {}
local detail = 50

for k = 0, detail-1 do
slopebox[k+1]={-0.5, (k/detail)-0.5, (k/detail)-0.5, 0.5, (k/detail)-0.5+(1/detail), 0.5}
end


@jeija...

i try to use your code, its working ...

just i run into the problem when i use this with my tree mod, that when the try is growing wiht the abm methode a error occur.

its "meshbuffer ran out of indices"

i am sure that is not because of your code, but what does it general point to? whats wrong?

okay two errors occur..

1. meshbuffer ran out of indices
2. to many vertices for 16bit index type, render artifacts may occur.


as mention a clean new world runs when i got the item's with /giveme, but as soon as i try to run this with the abm methode for a growing tree i get this mistakes.
Last edited by tkerwel on Wed Jul 11, 2012 07:53, edited 1 time in total.
++++ Kung walang tiyaga, walang nilaga. ++++
 

User avatar
tkerwel
Member
 
Posts: 213
Joined: Fri Jan 13, 2012 07:35

by tkerwel » Wed Jul 11, 2012 08:19

great to show that it works..

Image

Image


looks like i have done a big step for my tree's

thanks a lot

@Jeija
@jin_xi

the only question i still have is, how depp can be the "stair" level for such things. when i do "stairs" in the node box to small, sooner or later i got the error with the "meshbuffer"
Last edited by tkerwel on Wed Jul 11, 2012 08:21, edited 1 time in total.
++++ Kung walang tiyaga, walang nilaga. ++++
 

User avatar
tkerwel
Member
 
Posts: 213
Joined: Fri Jan 13, 2012 07:35

by tkerwel » Wed Jul 11, 2012 10:48

is there anywhere an torturial in english for the use of this

like how i adress this where is the zero point and which are the axes ?

fixed = {
{-0.50, -0.50, -0.50, 0.50, -0.45, 0.50},
{-0.45, -0.45, -0.45, 0.45, -0.40, 0.45},
{-0.40, -0.40, -0.40, 0.40, -0.35, 0.40},
{-0.35, -0.35, -0.35, 0.35, -0.30, 0.35},
{-0.30, -0.30, -0.30, 0.30, -0.25, 0.30},
{-0.25, -0.25, -0.25, 0.25, -0.20, 0.25},
{-0.20, -0.20, -0.20, 0.20, -0.15, 0.20},
{-0.15, -0.15, -0.15, 0.15, -0.10, 0.15},
{-0.10, -0.10, -0.10, 0.10, -0.05, 0.10},
{-0.05, -0.05, -0.05, 0.05, -0.00, 0.05},
++++ Kung walang tiyaga, walang nilaga. ++++
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

by Jeija » Wed Jul 11, 2012 11:34

{x,y,z,x,y,z}
z = right/left } Depens of course from what angle
x = back/forward } you look at it.
y = up/down

Zero point is the center of the node, so +-0.5 is the surface.


About the mesh buffer errors:
I don`t exactly know what causes them, I guess minetest simply cannot store that many vertices in a chunk/"mapblock".
Redstone for minetest: Mesecons (mesecons.net)
 

jin_xi
Member
 
Posts: 165
Joined: Mon Jul 02, 2012 18:19

by jin_xi » Wed Jul 11, 2012 14:17

in other words {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5} is a cube as in a single block of sand or any other material. thats two points diagonal from each other,
{x1, y1, z1, x2, y2, z2} which define the cube (or cuboid)...
 

User avatar
tkerwel
Member
 
Posts: 213
Joined: Fri Jan 13, 2012 07:35

by tkerwel » Wed Jul 11, 2012 14:24

@jin_xi and @Jeija

jep got it, look into my new thread, some basics are already working. maybe you guys have fun to add there some node_box simple models ?

anyway thank you both again, i learned a lot today to understand minetest better
++++ Kung walang tiyaga, walang nilaga. ++++
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 10 guests

cron