mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-12 16:58:39 +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:
parent
a80ecbee1e
commit
3caad3f3c9
25 changed files with 671 additions and 313 deletions
|
@ -91,6 +91,9 @@ public:
|
|||
}
|
||||
|
||||
bool getCollisionBox(aabb3f *toset) const { return false; }
|
||||
|
||||
virtual bool getSelectionBox(aabb3f *toset) const { return false; }
|
||||
|
||||
bool collideWithObjects() const { return false; }
|
||||
|
||||
private:
|
||||
|
@ -746,6 +749,18 @@ bool LuaEntitySAO::getCollisionBox(aabb3f *toset) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool LuaEntitySAO::getSelectionBox(aabb3f *toset) const
|
||||
{
|
||||
if (!m_prop.is_visible) {
|
||||
return false;
|
||||
}
|
||||
|
||||
toset->MinEdge = m_prop.collisionbox.MinEdge * BS;
|
||||
toset->MaxEdge = m_prop.collisionbox.MaxEdge * BS;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LuaEntitySAO::collideWithObjects() const
|
||||
{
|
||||
return m_prop.collideWithObjects;
|
||||
|
@ -1405,3 +1420,14 @@ bool PlayerSAO::getCollisionBox(aabb3f *toset) const
|
|||
toset->MaxEdge += m_base_position;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PlayerSAO::getSelectionBox(aabb3f *toset) const
|
||||
{
|
||||
if (!m_prop.is_visible) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getCollisionBox(toset);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue