summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDániel Juhász <juhdanad@gmail.com>2018-08-16 20:10:08 +0200
committerSmallJoker <SmallJoker@users.noreply.github.com>2018-08-16 20:10:08 +0200
commit325bf680410e8012394e5f3ba5ba947c69034899 (patch)
tree66ed6c2b0c9d7a1c915006212ecde535699e16c4 /doc
parent798724efeab2d71da4f041be99de86baa3d3cdd5 (diff)
downloadminetest-325bf680410e8012394e5f3ba5ba947c69034899.tar.gz
minetest-325bf680410e8012394e5f3ba5ba947c69034899.tar.bz2
minetest-325bf680410e8012394e5f3ba5ba947c69034899.zip
Raycast: export exact pointing location (#6304)
* Return intersection point in node coordinates. * Clarify 'intersection_point' documentation
Diffstat (limited to 'doc')
-rw-r--r--doc/lua_api.txt20
1 files changed, 18 insertions, 2 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 0c331577b..ef70fe6f7 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -1317,6 +1317,17 @@ For helper functions see [Spatial Vectors].
* `{type="node", under=pos, above=pos}`
* `{type="object", ref=ObjectRef}`
+Exact pointing location (currently only `Raycast` supports these fields):
+* `pointed_thing.intersection_point`: The absolute world coordinates of the
+ point on the selection box which is pointed at. May be in the selection box
+ if the pointer is in the box too.
+* `pointed_thing.box_id`: The ID of the pointed selection box (counting starts
+ from 1).
+* `pointed_thing.intersection_normal`: Unit vector, points outwards of the
+ selected selection box. This specifies which face is pointed at.
+ Is a null vector `{x = 0, y = 0, z = 0}` when the pointer is inside the
+ selection box.
+
@@ -5323,7 +5334,12 @@ It can be created via `PseudoRandom(seed)`.
---------
A raycast on the map. It works with selection boxes.
-Can be used as an iterator in a for loop.
+Can be used as an iterator in a for loop as:
+
+ local ray = Raycast(...)
+ for pointed_thing in ray do
+ ...
+ end
The map is loaded as the ray advances. If the map is modified after the
`Raycast` is created, the changes may or may not have an effect on the object.
@@ -5338,7 +5354,7 @@ It can be created via `Raycast(pos1, pos2, objects, liquids)` or
### Methods
-* `next()`: returns a `pointed_thing`
+* `next()`: returns a `pointed_thing` with exact pointing location
* Returns the next thing pointed by the ray or nil.
`SecureRandom`