Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
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.
 
 PointedThing (const v3s16 under, const v3s16 above, const v3s16 real_under, const v3f point, const v3f normal, u16 box_id, f32 distSq, PointabilityType pointab)
 Constructor for POINTEDTHING_NODE.
 
 PointedThing (u16 id, const v3f point, const v3f normal, const v3f raw_normal, f32 distSq, PointabilityType pointab)
 Constructor for POINTEDTHING_OBJECT.
 
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.
 
PointabilityType pointability = PointabilityType::POINTABLE_NOT
 How the object or node can be pointed at.
 
v3s16 node_undersurface
 
v3s16 node_abovesurface
 
v3s16 node_real_undersurface
 
u16 object_id = 0
 
u16 box_id = 0
 
v3f intersection_point
 
v3f intersection_normal
 
v3f raw_intersection_normal
 
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 v3f normal,
u16 box_id,
f32 distSq,
PointabilityType pointab )
inline

Constructor for POINTEDTHING_NODE.

◆ PointedThing() [3/3]

PointedThing::PointedThing ( u16 id,
const v3f point,
const v3f normal,
const v3f raw_normal,
f32 distSq,
PointabilityType pointab )
inline

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, readU16(), 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
inline

◆ 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, pointability, 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, writeU16(), 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

v3f 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(), ModApiEnv::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(), ModApiEnv::l_place_node(), RaycastSort::operator()(), operator==(), Game::processPlayerInteraction(), push_pointed_thing(), serialize(), GameUI::update(), and Game::updatePointedThing().

◆ object_id

u16 PointedThing::object_id = 0

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

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

◆ pointability

PointabilityType PointedThing::pointability = PointabilityType::POINTABLE_NOT

How the object or node can be pointed at.

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

◆ raw_intersection_normal

v3f PointedThing::raw_intersection_normal

Only valid if type is POINTEDTHING_OBJECT. Raw normal vector of the intersection before applying rotation.

Referenced by Game::updatePointedThing().

◆ type


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