- Documentation
- Server functions
- processLineAgainstMesh
Function
processLineAgainstMesh
Checks whether a segment crosses one specific element, treating it as a sphere of its radius (a server-side simplification). Returns the point on the segment closest to the element's centre.
Syntax
bool, float, float, float processLineAgainstMesh(element element, float sx, float sy, float sz, float ex, float ey, float ez)Arguments
elementelement- The element to test.
sxfloat- Start X.
syfloat- Start Y.
szfloat- Start Z.
exfloat- End X.
eyfloat- End Y.
ezfloat- End Z.
Returns
true and a point x, y, z, or false.
Example
addCommandHandler("trafiam", function(player, _, id)
local target = getElementByID(id or "")
if not target then return end
local x, y, z = getElementPosition(player)
local hit = processLineAgainstMesh(target, x, y, z + 0.6, x, y + 50, z + 0.6)
outputChatBox(hit and "Trafiony" or "Pudlo", player)
end)