mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-19 11:15:18 +02: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:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user