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 |
An active object or node which is selected by a ray on the map.
|
default |
Constructor for POINTEDTHING_NOTHING.
|
inline |
Constructor for POINTEDTHING_NODE.
|
inline |
Constructor for POINTEDTHING_OBJECT.
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().
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().
|
inline |
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.
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().
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().
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()().
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().
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().
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().
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==().
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().
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().
PointabilityType PointedThing::pointability = PointabilityType::POINTABLE_NOT |
How the object or node can be pointed at.
Referenced by Environment::continueRaycast(), and operator==().
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().
PointedThingType PointedThing::type = POINTEDTHING_NOTHING |
The type of the pointed object.
Referenced by Environment::continueRaycast(), deSerialize(), dump(), Server::handleCommand_Interact(), Game::handlePointingAtNothing(), LuaRaycast::l_next(), ModApiEnv::l_place_node(), RaycastSort::operator()(), operator==(), Game::processPlayerInteraction(), push_pointed_thing(), serialize(), GameUI::update(), and Game::updatePointedThing().