6d Facedir
- RealBadAngel
- Member
- Posts: 557
- Joined: Wed Jul 18, 2012 16:30
6d Facedir
New facedir gives you ability to rotate nodes in every direction.
If you want to check how it works please compile game from sources:
https://github.com/RealBadAngel/minetest
Note: By now rotating regular nodes is done (chests, furnaces etc)
Updated: new screwdriver in tools, more handy.
Added nodebox rotations to git.
(still need to work on nodeboxes bug)
Screwdriver mod to rotate nodes:
http://realbadangel.pl/facedirtools.zip
Facedir now has a different meanin:
Its value now defines direction in which top face of node is pointing and rotation over this direction.
Values = 0 to 23
facedir / 4 gives you direction:
0 -> y+
1 -> z+
2 -> z-
3 -> x+
4 -> x-
5 -> y-
facedir modulo 4 is the rotation
Old facedir is just one case of new one: y+ , so any old code will still work with new facedir.
Comments and suggestion are welcome.
If you want to check how it works please compile game from sources:
https://github.com/RealBadAngel/minetest
Note: By now rotating regular nodes is done (chests, furnaces etc)
Updated: new screwdriver in tools, more handy.
Added nodebox rotations to git.
(still need to work on nodeboxes bug)
Screwdriver mod to rotate nodes:
http://realbadangel.pl/facedirtools.zip
Facedir now has a different meanin:
Its value now defines direction in which top face of node is pointing and rotation over this direction.
Values = 0 to 23
facedir / 4 gives you direction:
0 -> y+
1 -> z+
2 -> z-
3 -> x+
4 -> x-
5 -> y-
facedir modulo 4 is the rotation
Old facedir is just one case of new one: y+ , so any old code will still work with new facedir.
Comments and suggestion are welcome.
Last edited by RealBadAngel on Sun Feb 17, 2013 12:53, edited 1 time in total.
- RealBadAngel
- Member
- Posts: 557
- Joined: Wed Jul 18, 2012 16:30
1) I already wrote it: old facedir is just one case of new one. So any old code either mod or engine will work as before.PilzAdam wrote:1st: Is this compatible with the old system? (i.e. you load an old map and everything is rotated correctly)
2nd: Is this applied to paramtype2 = "facedir" or "wallmounted"? The current API uses facedir as horizontal only, and wallmounted also has vertical rotation.
2) its facedir, not wallmounted
- RealBadAngel
- Member
- Posts: 557
- Joined: Wed Jul 18, 2012 16:30
-
- Member
- Posts: 81
- Joined: Mon Jan 28, 2013 12:29
- Location: España
Good Mod , works well .
Forgive my English, but it is the translator of google.My Spanish.
My mod:
Pictures wool 1.0 3x5 , Charcoal+Textures , Map
My mod:
Pictures wool 1.0 3x5 , Charcoal+Textures , Map
- RealBadAngel
- Member
- Posts: 557
- Joined: Wed Jul 18, 2012 16:30
-
- Member
- Posts: 81
- Joined: Mon Jan 28, 2013 12:29
- Location: España
Jordach wrote:This isnt a mod, but a source code containing a possible update.socramazibi wrote:Good Mod , works well .
RealBadAngel wrote: Screwdriver mod to rotate nodes:
http://realbadangel.pl/facedirtools.zip

It seems a Mod.
Forgive my English, but it is the translator of google.My Spanish.
My mod:
Pictures wool 1.0 3x5 , Charcoal+Textures , Map
My mod:
Pictures wool 1.0 3x5 , Charcoal+Textures , Map
- VanessaE
- Member
- Posts: 4655
- Joined: Sun Apr 01, 2012 12:38
- GitHub: VanessaE
- IRC: VanessaE
- In-game: VanessaE
- Location: Western NC
- Contact:
It's both an engine patch to create the feature, and an Lua mod to enable a player to make use of it.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)
- khonkhortisan
- Member
- Posts: 30
- Joined: Fri Jun 29, 2012 17:30
This has been merged.
Facedir 0-3 remains unchanged, but has been extended to 23.
Axes:
0 Y+
1 Z+
2 Z-
3 X+
4 X-
5 Y-
Rotations (clockwise):
0 0
1 90
2 180
3 270
Axis * 4 + Rotation = Facedir
0 0 0
0 1 1
0 2 2
0 3 3
1 0 4
1 1 5
1 2 6
1 3 7
2 0 8
2 1 9
2 2 10
2 3 11
3 0 12
3 1 13
3 2 14
3 3 15
4 0 16
4 1 17
4 2 18
4 3 19
5 0 20
5 1 21
5 2 22
5 3 23
Faces by axis by rotation:
(nodebox above, node below, xyz is rgb, lighter is positive)






How to rotate (clockwise) by axis from any facedir:
(this will be made into a lua function)
-X+
(3,0) (3,1) (3,2) (3,3)
(4,0) (4,3) (4,2) (4,1)
(0,0) (1,0) (5,2) (2,0)
(0,1) (1,1) (5,3) (2,1)
(0,2) (1,2) (5,0) (2,2)
(0,3) (1,3) (5,1) (2,3)
-Y+
(0,0) (0,1) (0,2) (0,3)
(5,0) (5,3) (5,2) (5,1)
(1,0) (3,1) (2,2) (4,3)
(2,0) (4,1) (1,2) (3,3)
(3,0) (2,1) (4,2) (1,3)
(4,0) (1,1) (3,2) (2,3)
-Z+
(1,0) (1,1) (1,2) (1,3)
(2,0) (2,3) (2,2) (2,1)
(0,0) (4,0) (5,0) (3,0)
(0,1) (4,1) (5,1) (3,1)
(0,2) (4,2) (5,2) (3,2)
(0,3) (4,3) (5,3) (3,3)
Facedir 0-3 remains unchanged, but has been extended to 23.
Axes:
0 Y+
1 Z+
2 Z-
3 X+
4 X-
5 Y-
Rotations (clockwise):
0 0
1 90
2 180
3 270
Axis * 4 + Rotation = Facedir
0 0 0
0 1 1
0 2 2
0 3 3
1 0 4
1 1 5
1 2 6
1 3 7
2 0 8
2 1 9
2 2 10
2 3 11
3 0 12
3 1 13
3 2 14
3 3 15
4 0 16
4 1 17
4 2 18
4 3 19
5 0 20
5 1 21
5 2 22
5 3 23
Faces by axis by rotation:
(nodebox above, node below, xyz is rgb, lighter is positive)






How to rotate (clockwise) by axis from any facedir:
(this will be made into a lua function)
-X+
(3,0) (3,1) (3,2) (3,3)
(4,0) (4,3) (4,2) (4,1)
(0,0) (1,0) (5,2) (2,0)
(0,1) (1,1) (5,3) (2,1)
(0,2) (1,2) (5,0) (2,2)
(0,3) (1,3) (5,1) (2,3)
-Y+
(0,0) (0,1) (0,2) (0,3)
(5,0) (5,3) (5,2) (5,1)
(1,0) (3,1) (2,2) (4,3)
(2,0) (4,1) (1,2) (3,3)
(3,0) (2,1) (4,2) (1,3)
(4,0) (1,1) (3,2) (2,3)
-Z+
(1,0) (1,1) (1,2) (1,3)
(2,0) (2,3) (2,2) (2,1)
(0,0) (4,0) (5,0) (3,0)
(0,1) (4,1) (5,1) (3,1)
(0,2) (4,2) (5,2) (3,2)
(0,3) (4,3) (5,3) (3,3)
Last edited by khonkhortisan on Sun Mar 24, 2013 03:38, edited 1 time in total.
- Likwid H-Craft
- Member
- Posts: 1113
- Joined: Sun Jan 06, 2013 14:20
- Location: Lost in Crypt
Talking about Facedir is there a way do the middle like how mc has it, Cauldron has a hole.
My Domain's/others:
http://likwidtest.hj.cx/ (Not Done)
http://likwidtest.hj.cx/ (Not Done)
- khonkhortisan
- Member
- Posts: 30
- Joined: Fri Jun 29, 2012 17:30
The command minetest.dir_to_facedir() needs to be updated. It only gives the x and z directions. It can't handle the y direction. I am using the latest PilzAdam, sfan5 and BlockMen builds on Windows XP and was trying to set up a mod that uses this function but couldn't get any y direction. I had to use the pitch and sort of override the facedir for any pitch greater than a certain amount. By the way, I was getting the players facedir if that makes any difference.
- hoodedice
- Member
- Posts: 1374
- Joined: Sat Jul 06, 2013 06:33
- GitHub: hoodedice
- IRC: hoodedice
- In-game: hoodedice
- Location: world
- Contact:
LionsDen wrote:... I am using the latest PilzAdam, sfan5 and BlockMen builds on Windows XP....
Last edited by hoodedice on Sun Aug 04, 2013 18:03, edited 1 time in total.
7:42 PM - Bauglio: I think if you go to staples you could steal firmware from a fax machine that would run better than win10 does on any platform
7:42 PM - Bauglio: so fudge the stable build
7:43 PM - Bauglio: get the staple build
7:42 PM - Bauglio: so fudge the stable build
7:43 PM - Bauglio: get the staple build
-
- Member
- Posts: 106
- Joined: Tue Jan 01, 2013 18:47
- GitHub: hdastwb
- IRC: hdastwb
- In-game: hdastwb
- Location: United States
I fixed that recently (https://github.com/minetest/minetest/pull/834), but in order to use the 6d version you'll have to pass the optional parameter at the end to enable it (it's disabled by default because it would break an awful lot of placing code). See https://github.com/VanessaE/pipeworks/b ... r.lua#L184 for a usage example.LionsDen wrote:The command minetest.dir_to_facedir() needs to be updated. It only gives the x and z directions. It can't handle the y direction. I am using the latest PilzAdam, sfan5 and BlockMen builds on Windows XP and was trying to set up a mod that uses this function but couldn't get any y direction. I had to use the pitch and sort of override the facedir for any pitch greater than a certain amount. By the way, I was getting the players facedir if that makes any difference.
I just tried this with the following code snippet:hdastwb wrote:I fixed that recently (https://github.com/minetest/minetest/pull/834), but in order to use the 6d version you'll have to pass the optional parameter at the end to enable it (it's disabled by default because it would break an awful lot of placing code). See https://github.com/VanessaE/pipeworks/b ... r.lua#L184 for a usage example.
Code: Select all
minetest.dir_to_facedir(user:get_look_dir(), true)
EDIT: Just tried it without the minetest. in front and it crashed so that wasn't my problem.
Last edited by LionsDen on Mon Aug 05, 2013 15:55, edited 1 time in total.
-
- Member
- Posts: 106
- Joined: Tue Jan 01, 2013 18:47
- GitHub: hdastwb
- IRC: hdastwb
- In-game: hdastwb
- Location: United States
Assuming that your minetest version is from after about two weeks ago, if you call minetest.dir_to_facedir(dir, true) and the absolute value of dir's y component is greater than both the x and z components' absolute values, then your result should be some number > 3.LionsDen wrote: I just tried this with the following code snippet:
and still only got x and z coordinates. As far as I can tell from the pipeworks example you showed, I have the usage right.Code: Select all
minetest.dir_to_facedir(user:get_look_dir(), true)
EDIT: Just tried it without the minetest. in front and it crashed so that wasn't my problem.
dir_to_facedir is implemented in Lua, so one easy way to check if your version is new enough would be to open up builtin/item.lua and scan down to around line 37; if you don't see the is6d parameter in the definition of dir_to_facedir, then your build doesn't support it yet. That said, though, since it's Lua you can change the definitions of those functions without having to rebuild. Another option would be to do what I did in pipeworks and define those functions as local functions at the top of every file that uses them, and then eventually switch to the standardized versions when 0.4.8 comes out.
hdastwb wrote:Assuming that your minetest version is from after about two weeks ago, if you call minetest.dir_to_facedir(dir, true) and the absolute value of dir's y component is greater than both the x and z components' absolute values, then your result should be some number > 3.
dir_to_facedir is implemented in Lua, so one easy way to check if your version is new enough would be to open up builtin/item.lua and scan down to around line 37; if you don't see the is6d parameter in the definition of dir_to_facedir, then your build doesn't support it yet. That said, though, since it's Lua you can change the definitions of those functions without having to rebuild. Another option would be to do what I did in pipeworks and define those functions as local functions at the top of every file that uses them, and then eventually switch to the standardized versions when 0.4.8 comes out.
Yeah, didn't know about the 2 week limit for it. I was using the 07/24/2013 version of PilzAdam's build to test it. I just looked and it doesn't have the new facedir. I do also have BlockMen's and sfan5's version which is around 1 day old or so and both have the new facedir. I'll try to run the test again using the newer versions. It'll probably have to wait until tomorrow as I wasn't home today and don't have time to play tonight with it. Thanks for the info and I just might use your idea to code my own version based on what the new item.lua's have in them. It depends on if I will be releasing that mod before or after v0.4.8 comes out.