File tree 2 files changed +12
-0
lines changed
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,14 @@ function core.wallmounted_to_dir(wallmounted)
147
147
return wallmounted_to_dir [wallmounted ]
148
148
end
149
149
150
+ function core .dir_to_yaw (dir )
151
+ return - math.atan2 (dir .x , dir .z )
152
+ end
153
+
154
+ function core .yaw_to_dir (yaw )
155
+ return {x = - math.sin (yaw ), y = 0 , z = math.cos (yaw )}
156
+ end
157
+
150
158
function core .get_node_drops (nodename , toolname )
151
159
local drop = ItemStack ({name = nodename }):get_definition ().drop
152
160
if drop == nil then
Original file line number Diff line number Diff line change @@ -2403,6 +2403,10 @@ and `minetest.auth_reload` call the authetification handler.
2403
2403
* Convert a vector to a wallmounted value, used for `paramtype2="wallmounted"`
2404
2404
* `minetest.wallmounted_to_dir(wallmounted)`
2405
2405
* Convert a wallmounted value back into a vector aimed directly out the "back" of a node
2406
+ * `minetest.dir_to_yaw(dir)`
2407
+ * Convert a vector into a yaw (angle)
2408
+ * `minetest.yaw_to_dir(yaw)`
2409
+ * Convert yaw (angle) to a vector
2406
2410
* `minetest.get_node_drops(nodename, toolname)`
2407
2411
* Returns list of item names.
2408
2412
* **Note**: This will be removed or modified in a future version.
You can’t perform that action at this time.
0 commit comments