Minetest  5.4.0
PointedThing Struct Reference

An active object or node which is selected by a ray on the map. More...

#include <pointedthing.h>

Public Member Functions

 PointedThing ()=default
 Constructor for POINTEDTHING_NOTHING. More...
 
 PointedThing (const v3s16 &under, const v3s16 &above, const v3s16 &real_under, const v3f &point, const v3s16 &normal, u16 box_id, f32 distSq)
 Constructor for POINTEDTHING_NODE. More...
 
 PointedThing (s16 id, const v3f &point, const v3s16 &normal, f32 distSq)
 Constructor for POINTEDTHING_OBJECT. More...
 
std::string dump () const
 
void serialize (std::ostream &os) const
 
void deSerialize (std::istream &is)
 
bool operator== (const PointedThing &pt2) const
 
bool operator!= (const PointedThing &pt2) const
 

Public Attributes

PointedThingType type = POINTEDTHING_NOTHING
 The type of the pointed object. More...
 
v3s16 node_undersurface
 
v3s16 node_abovesurface
 
v3s16 node_real_undersurface
 
s16 object_id = -1
 
v3f intersection_point
 
v3s16 intersection_normal
 
u16 box_id = 0
 
f32 distanceSq = 0
 

Detailed Description

An active object or node which is selected by a ray on the map.

Constructor & Destructor Documentation

◆ PointedThing() [1/3]

PointedThing::PointedThing ( )
default

Constructor for POINTEDTHING_NOTHING.

◆ PointedThing() [2/3]

PointedThing::PointedThing ( const v3s16 under,
const v3s16 above,
const v3s16 real_under,
const v3f point,
const v3s16 normal,
u16  box_id,
f32  distSq 
)

Constructor for POINTEDTHING_NODE.

◆ PointedThing() [3/3]

PointedThing::PointedThing ( s16  id,
const v3f point,
const v3s16 normal,
f32  distSq 
)

Constructor for POINTEDTHING_OBJECT.

Member Function Documentation

◆ deSerialize()

void PointedThing::deSerialize ( std::istream &  is)

References node_abovesurface, node_undersurface, object_id, POINTEDTHING_NODE, POINTEDTHING_NOTHING, POINTEDTHING_OBJECT, readS16(), readU8(), readV3S16(), and type.

Referenced by Server::handleCommand_Interact().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump()

std::string PointedThing::dump ( ) const

References node_abovesurface, node_undersurface, object_id, POINTEDTHING_NODE, POINTEDTHING_NOTHING, POINTEDTHING_OBJECT, and type.

Referenced by Server::handleCommand_Interact(), and Game::processPlayerInteraction().

+ Here is the caller graph for this function:

◆ operator!=()

bool PointedThing::operator!= ( const PointedThing pt2) const

◆ operator==()

bool PointedThing::operator== ( const PointedThing pt2) const

This function ignores the intersection point and normal.

References node_abovesurface, node_real_undersurface, node_undersurface, object_id, POINTEDTHING_NODE, POINTEDTHING_OBJECT, and type.

◆ serialize()

void PointedThing::serialize ( std::ostream &  os) const

References node_abovesurface, node_undersurface, object_id, POINTEDTHING_NODE, POINTEDTHING_NOTHING, POINTEDTHING_OBJECT, type, writeS16(), writeU8(), and writeV3S16().

Referenced by Client::interact().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ box_id

u16 PointedThing::box_id = 0

Only valid if type isn't POINTEDTHING_NONE. Indicates which selection box is selected, if there are more of them.

Referenced by Environment::continueRaycast(), and push_pointed_thing().

◆ distanceSq

f32 PointedThing::distanceSq = 0

Square of the distance between the pointing ray's start point and the intersection point in irrlicht coordinates.

Referenced by Environment::continueRaycast(), and RaycastSort::operator()().

◆ intersection_normal

v3s16 PointedThing::intersection_normal

Only valid if type isn't POINTEDTHING_NONE. Normal vector of the intersection. This is perpendicular to the face the ray hits, points outside of the box and it's length is 1.

Referenced by Environment::continueRaycast(), push_pointed_thing(), and Game::updatePointedThing().

◆ intersection_point

v3f PointedThing::intersection_point

Only valid if type isn't POINTEDTHING_NONE. First intersection point of the ray and the nodebox in irrlicht coordinates.

Referenced by Environment::continueRaycast(), and push_pointed_thing().

◆ node_abovesurface

v3s16 PointedThing::node_abovesurface

Only valid if type is POINTEDTHING_NODE. The coordinates of the last node the ray intersects before node_undersurface. Same as node_undersurface if the ray starts in a nodebox.

Referenced by Environment::continueRaycast(), deSerialize(), dump(), Server::handleCommand_Interact(), Game::handlePointingAtNode(), ModApiEnvMod::l_place_node(), operator==(), push_pointed_thing(), and serialize().

◆ node_real_undersurface

v3s16 PointedThing::node_real_undersurface

Only valid if type is POINTEDTHING_NODE. The coordinates of the node which contains the point of the collision and the nodebox of the node.

Referenced by Environment::continueRaycast(), and operator==().

◆ node_undersurface

v3s16 PointedThing::node_undersurface

Only valid if type is POINTEDTHING_NODE. The coordinates of the node which owns the nodebox that the ray hits first. This may differ from node_real_undersurface if a nodebox exceeds the limits of its node.

Referenced by Environment::continueRaycast(), deSerialize(), dump(), Server::handleCommand_Interact(), Game::handlePointingAtNode(), ModApiEnvMod::l_place_node(), RaycastSort::operator()(), operator==(), Game::processPlayerInteraction(), push_pointed_thing(), serialize(), GameUI::update(), and Game::updatePointedThing().

◆ object_id

s16 PointedThing::object_id = -1

Only valid if type is POINTEDTHING_OBJECT. The ID of the object the ray hit.

Referenced by deSerialize(), dump(), Server::handleCommand_Interact(), RaycastSort::operator()(), operator==(), push_pointed_thing(), serialize(), and Game::updatePointedThing().

◆ type


The documentation for this struct was generated from the following files: