Difference between revisions of "pointed thing"

From Minetest Developer Wiki
Jump to navigation Jump to search
(note about minetest.get_pointed_thing_position)
Line 8: Line 8:
 
* <code>above</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>
 
* <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 ==

Revision as of 03:44, 19 June 2013

Table {type = …, under = …, above = …, ref = …}

  • type
  • "nothing"
  • "node"
  • "object"

Notes

  • The utility function minetest.get_pointed_thing_position(pointed_thing, above) can be used to calculate the position of pointed_thing without having to distinguish all possible types.

Examples

{type="nothing"}
{type="node", under=pos, above=pos}
{type="object", ref=ObjectRef}

pointed thing 1.png

Node coordinates are (49,6,-13), pointed_thing is {type = "node", above = {y = 7, x = 49, z = -13}, under = {y = 6, x = 49, z = -13}}

pointed thing 2.png

Node coordinates are (50,7,-13), pointed_thing is {type = "node", above = {y = 7, x = 49, z = -13}, under = {y = 7, x = 50, z = -13}}

pointed thing 3.png

Node coordinates are (49,7,-14), pointed_thing is {type = "node", above = {y = 7, x = 49, z = -13}, under = {y = 7, x = 49, z = -14}}