Page 1 of 1
anyone already design a triangle/pyramide-block?

Posted:
Tue Jul 10, 2012 11:09
by tkerwel
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

Posted:
Tue Jul 10, 2012 14:31
by jin_xi
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}
})

Posted:
Tue Jul 10, 2012 14:46
by jin_xi
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?

Posted:
Tue Jul 10, 2012 14:55
by tkerwel
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

Posted:
Tue Jul 10, 2012 15:00
by Jeija
I have been working on this quite a while ago:
Irregular 3D ObjectsThat mod creates the nodeboxes in several for-loops which makes it easy to define different detail levels and make other structures from scratch.

Posted:
Wed Jul 11, 2012 06:38
by tkerwel
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.

Posted:
Wed Jul 11, 2012 08:19
by tkerwel
great to show that it works..


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"

Posted:
Wed Jul 11, 2012 10:48
by tkerwel
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},

Posted:
Wed Jul 11, 2012 11:34
by Jeija
{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".

Posted:
Wed Jul 11, 2012 14:17
by jin_xi
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)...

Posted:
Wed Jul 11, 2012 14:24
by tkerwel
@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