1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00:00

Expose getPointedThing to Lua

This commit introduces Raycast, a Lua user object, which can be
used to perform a raycast on the map. The ray is continuable, so one can
also get hidden nodes (for example to see trough glass).
This commit is contained in:
Dániel Juhász 2016-07-23 21:11:20 +02:00 committed by paramat
parent a80ecbee1e
commit 3caad3f3c9
25 changed files with 671 additions and 313 deletions

View file

@ -283,8 +283,14 @@ public:
void initialize(const std::string &data);
aabb3f *getSelectionBox()
{return &m_selection_box;}
virtual bool getSelectionBox(aabb3f *toset) const
{
*toset = m_selection_box;
return true;
}
v3f getPosition()
{return m_position;}
inline float getYaw() const
@ -605,11 +611,14 @@ GenericCAO::~GenericCAO()
removeFromScene(true);
}
aabb3f *GenericCAO::getSelectionBox()
bool GenericCAO::getSelectionBox(aabb3f *toset) const
{
if(!m_prop.is_visible || !m_is_visible || m_is_local_player || getParent() != NULL)
return NULL;
return &m_selection_box;
if (!m_prop.is_visible || !m_is_visible || m_is_local_player
|| getParent() != NULL){
return false;
}
*toset = m_selection_box;
return true;
}
v3f GenericCAO::getPosition()
@ -658,7 +667,7 @@ void GenericCAO::setAttachments()
updateAttachments();
}
ClientActiveObject* GenericCAO::getParent()
ClientActiveObject* GenericCAO::getParent() const
{
ClientActiveObject *obj = NULL;