Difference between revisions of "pointed thing"

From Minetest Developer Wiki
Jump to navigation Jump to search
(note about minetest.get_pointed_thing_position)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{UnofficialLua}}
 
{{DISPLAYTITLE:pointed_thing}}
 
{{DISPLAYTITLE:pointed_thing}}
Table <source enclose="none">{type = …, under = …, above = …, ref = …}</source>
 
* <code>type</code>
 
:* <source enclose="none">"nothing"</source>
 
:* <source enclose="none">"node"</source>
 
:* <source enclose="none">"object"</source>
 
* <code>under</code> — [[position]] or <source enclose="none">nil</source>
 
* <code>above</code> — [[position]] or <source enclose="none">nil</source>
 
* <code>ref</code> — [[ObjectRef]] or <source enclose="none">nil</source>
 
 
== Notes ==
 
* The utility function <source enclose="none">minetest.get_pointed_thing_position(pointed_thing, above)</source> can be used to calculate the position of <code>pointed_thing</code> without having to distinguish all possible types.
 
  
 
== Examples ==
 
== Examples ==
<source>
 
{type="nothing"}
 
{type="node", under=pos, above=pos}
 
{type="object", ref=ObjectRef}
 
</source>
 
 
[[File:pointed_thing_1.png|200px]]
 
 
Node coordinates are <code>(49,6,-13)</code>, <code>pointed_thing</code> is <code>{type = "node", above = {y = 7, x = 49, z = -13}, under = {y = 6, x = 49, z = -13}}</code>
 
 
[[File:pointed_thing_2.png|200px]]
 
 
Node coordinates are <code>(50,7,-13)</code>, <code>pointed_thing</code> is <code>{type = "node", above = {y = 7, x = 49, z = -13}, under = {y = 7, x = 50, z = -13}}</code>
 
  
[[File:pointed_thing_3.png|200px]]
+
{| class="wikitable"
 +
!image
 +
!Node coordinates
 +
!pointed_thing.above
 +
!pointed_thing.under
 +
|-
 +
| [[File:pointed_thing_1.png|200px]]
 +
| <code>(49,6,-13)</code>
 +
| <code>{x = 49, y = 7, z = -13}</code>
 +
| <code>{x = 49, y = 6, z = -13}</code>
 +
|-
 +
| [[File:pointed_thing_2.png|200px]]
  
Node coordinates are <code>(49,7,-14)</code>, <code>pointed_thing</code> is <code>{type = "node", above = {y = 7, x = 49, z = -13}, under = {y = 7, x = 49, z = -14}}</code>
+
| <code>(50,7,-13)</code>
 +
| <code>{x = 49, y = 7, z = -13}</code>
 +
| <code>{x = 50, y = 7, z = -13}</code>
 +
|-
 +
| [[File:pointed_thing_3.png|200px]]
  
 +
| <code>(49,7,-14)</code>
 +
| <code>{x = 49, y = 7, z = -13}</code>
 +
| <code>{x = 49, y = 7,  z = -14}</code>
 +
|}
 
[[Category:Types]]
 
[[Category:Types]]

Latest revision as of 19:44, 25 January 2023

Mbox warning.png This page contains unofficial, low-quality Lua API documentation and is likely to be outdated or wrong. Do not rely on it!
For the official and up-to-date documentation, see Lua API Documentation.
Mbox warning.png This page has been proposed for deletion for the following reason: "Contains unofficial and potentially outdated, redundant and inconsistent Lua API information"
If you don't think that this page should be deleted, please explain why on the talk page.


Examples

image Node coordinates pointed_thing.above pointed_thing.under
pointed thing 1.png (49,6,-13) {x = 49, y = 7, z = -13} {x = 49, y = 6, z = -13}
pointed thing 2.png (50,7,-13) {x = 49, y = 7, z = -13} {x = 50, y = 7, z = -13}
pointed thing 3.png (49,7,-14) {x = 49, y = 7, z = -13} {x = 49, y = 7, z = -14}