forked from hkc/cc-stuff
wallhack: print distance to each entity
This commit is contained in:
parent
e8e980cbae
commit
3e2835419d
|
@ -30,6 +30,10 @@ return function()
|
|||
return {x = u.x + v.x, y = u.y + v.y, z = u.z + v.z}
|
||||
end
|
||||
|
||||
local function vec3Abs(v)
|
||||
return math.sqrt(dotProduct3(v, v))
|
||||
end
|
||||
|
||||
local function toFrontCoords(entity)
|
||||
local dotResult = dotProduct3(entity, playerLookVector)
|
||||
if dotResult >= 0.0 then
|
||||
|
@ -80,7 +84,7 @@ return function()
|
|||
if player.isSneaking then
|
||||
cache[id].text.setText(entity.name .. "\n" .. textutils.serialize(entity))
|
||||
else
|
||||
cache[id].text.setText(("%s\n{%.2f, %.2f, %.2f}"):format(entity.name, entity.x, entity.y, entity.z))
|
||||
cache[id].text.setText(("%s\n|{%.2f, %.2f, %.2f}| = %.2f"):format(entity.name, entity.x, entity.y, entity.z, vec3Abs(entity)))
|
||||
end
|
||||
if entityFront.flipped then
|
||||
cache[id].text.setColor(0x00FFFFFF)
|
||||
|
|
Loading…
Reference in New Issue