Hello, is it possible to get the node direction as a number, example: the node direction at the point (0,0,0) is (-270)
is it possible to get this?
Hasan wrote:the node direction at the point (0,0,0) is (-270)
-- Get node data
local node = minetest.get_node(vector.new(0, 0, 0))
-- Get dir as vector (x, y, z), but only read the x and z axis (modulo 4)
local dir = minetest.facedir_to_dir(node.param2 % 4)
-- Calculate dir to angle UNTESTED
local angle = 0
if dir.z == 1 then
angle = 90
elseif dir.x == -1 then
angle = 180
elseif dir.z == -1 then
angle = 270
end
Krock wrote:Hasan wrote:the node direction at the point (0,0,0) is (-270)
I assume you want to get the rotation, then you can use this code: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
-- Get node data
local node = minetest.get_node(vector.new(0, 0, 0))
-- Get dir as vector (x, y, z), but only read the x and z axis (modulo 4)
local dir = minetest.facedir_to_dir(node.param2 % 4)
-- Calculate dir to angle UNTESTED
local angle = 0
if dir.z == 1 then
angle = 90
elseif dir.x == -1 then
angle = 180
elseif dir.z == -1 then
angle = 270
end
Users browsing this forum: No registered users and 7 guests