6d Facedir

User avatar
RealBadAngel
Member
 
Posts: 557
Joined: Wed Jul 18, 2012 16:30

6d Facedir

by RealBadAngel » Sun Feb 17, 2013 10:22

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.
Last edited by RealBadAngel on Sun Feb 17, 2013 12:53, edited 1 time in total.
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
Location: Germany
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Sun Feb 17, 2013 10:56

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.
 

User avatar
RealBadAngel
Member
 
Posts: 557
Joined: Wed Jul 18, 2012 16:30

by RealBadAngel » Sun Feb 17, 2013 11:02

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.


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.
2) its facedir, not wallmounted
 

User avatar
RealBadAngel
Member
 
Posts: 557
Joined: Wed Jul 18, 2012 16:30

by RealBadAngel » Sun Feb 17, 2013 12:54

Ive updated screwdriver, check it out, its way better now :)
Also updated engine to rotate nodeboxes. Try to rotate all calinou's stairs+ nodes now.
 

socramazibi
Member
 
Posts: 81
Joined: Mon Jan 28, 2013 12:29
Location: España

by socramazibi » Sun Feb 17, 2013 13:20

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
 

User avatar
Jordach
Member
 
Posts: 4523
Joined: Mon Oct 03, 2011 17:58
Location: Blender Scene
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Sun Feb 17, 2013 13:24

socramazibi wrote:Good Mod , works well .
This isnt a mod, but a source code containing a possible update.
viewtopic.php?f=10&t=19056 Solar Plains Dev Server
 

User avatar
0gb.us
Member
 
Posts: 841
Joined: Sun Sep 16, 2012 01:55
Location: 0gb.us:30000

by 0gb.us » Sun Feb 17, 2013 15:00

Oh, wow. If I understand this correctly, it is now possible to turn a chest on its side!

I'll have to try this later. I'm too busy to try it right away, but I'm curious to see how it functions in certain situations.
 

User avatar
RealBadAngel
Member
 
Posts: 557
Joined: Wed Jul 18, 2012 16:30

by RealBadAngel » Tue Feb 19, 2013 02:54

Updated screwdriver, now it has four modes. Read in game messages on how to use it.
 

socramazibi
Member
 
Posts: 81
Joined: Mon Jan 28, 2013 12:29
Location: España

by socramazibi » Tue Feb 19, 2013 08:42

Jordach wrote:
socramazibi wrote:Good Mod , works well .
This isnt a mod, but a source code containing a possible update.


RealBadAngel wrote:Screwdriver mod to rotate nodes:
http://realbadangel.pl/facedirtools.zip


Image

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
 

User avatar
VanessaE
Moderator
 
Posts: 4468
Joined: Sun Apr 01, 2012 12:38
Location: Waynesville, NC
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE

by VanessaE » Wed Feb 20, 2013 04:21

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)
 

User avatar
khonkhortisan
Member
 
Posts: 30
Joined: Fri Jun 29, 2012 17:30

by khonkhortisan » Fri Mar 01, 2013 01:18

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)
Image
Image
Image
Image
Image
Image

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.
 

User avatar
Likwid H-Craft
Member
 
Posts: 1113
Joined: Sun Jan 06, 2013 14:20
Location: Lost in Crypt

by Likwid H-Craft » Wed Mar 27, 2013 17:09

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)
 

User avatar
khonkhortisan
Member
 
Posts: 30
Joined: Fri Jun 29, 2012 17:30

by khonkhortisan » Sun Mar 31, 2013 22:34

Likwid H-Craft wrote:Talking about Facedir is there a way do the middle like how mc has it, Cauldron has a hole.

That doesn't have to do with facedir (whole-node rotations) but with nodeboxes, where you can have a single node being made out of multiple rectangular prisms.
 

User avatar
LionsDen
Member
 
Posts: 530
Joined: Thu Jun 06, 2013 03:19

by LionsDen » Sun Aug 04, 2013 17:41

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.
 

User avatar
hoodedice
Member
 
Posts: 1372
Joined: Sat Jul 06, 2013 06:33
Location: world
GitHub: hoodedice
IRC: hoodedice
In-game: hoodedice

by hoodedice » Sun Aug 04, 2013 18:02

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
 

User avatar
LionsDen
Member
 
Posts: 530
Joined: Thu Jun 06, 2013 03:19

by LionsDen » Sun Aug 04, 2013 23:17

hoodedice wrote:
LionsDen wrote:... I am using the latest PilzAdam, sfan5 and BlockMen builds on Windows XP....


I have been playing with all three. Just to see if I notice any differences like I did with an earlier BlockMen build.
 

hdastwb
Member
 
Posts: 106
Joined: Tue Jan 01, 2013 18:47
Location: United States
GitHub: hdastwb
IRC: hdastwb
In-game: hdastwb

by hdastwb » Mon Aug 05, 2013 00:10

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 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/blob/master/node_breaker.lua#L184 for a usage example.
 

User avatar
LionsDen
Member
 
Posts: 530
Joined: Thu Jun 06, 2013 03:19

by LionsDen » Mon Aug 05, 2013 15:52

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/blob/master/node_breaker.lua#L184 for a usage example.


I just tried this with the following code snippet:

Code: Select all
minetest.dir_to_facedir(user:get_look_dir(), true)


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.

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.
 

hdastwb
Member
 
Posts: 106
Joined: Tue Jan 01, 2013 18:47
Location: United States
GitHub: hdastwb
IRC: hdastwb
In-game: hdastwb

by hdastwb » Mon Aug 05, 2013 21:53

LionsDen wrote:I just tried this with the following code snippet:

Code: Select all
minetest.dir_to_facedir(user:get_look_dir(), true)


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.

EDIT: Just tried it without the minetest. in front and it crashed so that wasn't my problem.


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.
 

User avatar
LionsDen
Member
 
Posts: 530
Joined: Thu Jun 06, 2013 03:19

by LionsDen » Tue Aug 06, 2013 01:49

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.
 


Return to WIP Mods



Who is online

Users browsing this forum: No registered users and 10 guests