i modified the old geoglasses code to work with openglasses 2. the code is as follows:
local com=require("component")local arg={...}local glass=com.glasses
glass.removeAll()local geo=com.geolyzer
local size=tonumber(arg[2])or16local pl=tonumber(arg[1]or3)local minpl =2local maxpl =5local maxY
if(tonumber(arg[3])or0)==0then maxY=1else maxY=size endlocalfunction tocolor(pl)local color =(pl-minpl)/maxpl
if color<0thenreturn{1,1,1}elseif color>1thenreturn{1,0,1}elsereturn{color,1-color,0}endendfunction create(x,y,z,p)local a=component.glasses.addText3D()
a.set3DPos(x,y,z)
a.setColor(table.unpack(tocolor(p)))
a.setText(p)endfor x=-size,size dofor z=-size,size do
tile=geo.scan(x,z)
os.sleep(0)for Y=-math.min(size,18),math.min(maxY,18)dolocal y=Y+32if tile[y]>pl then create(x+0.5,Y+0.5,z+0.5,tile[y])endendendend
print("found objects:", glass.getObjectCount())
when i try to run it I get the error of tried to index components, geolyzer returned nill value. I have a geolyzer in both the tablet and glasses. What could be the problem?
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
i modified the old geoglasses code to work with openglasses 2. the code is as follows:
when i try to run it I get the error of tried to index components, geolyzer returned nill value. I have a geolyzer in both the tablet and glasses. What could be the problem?
Link to post
Share on other sites