-
Notifications
You must be signed in to change notification settings - Fork 18
Widget_EntityTracker3D
ben-mkiv edited this page Feb 14, 2019
·
3 revisions
widget = component.glasses.addEntityTracker3D()
-- adds a EntityTracker3D to the 3D World Spacewidget.loadOBJ(String:waveFrontObjectData)
-- loads the model, which is displayed at entities, from the parsed object data
widget.setTrackingType(String:trackingtype, Integer:radius)
-- trackingtype - [NONE, ALL, UNIQUE, ITEM, LIVING, PLAYER, NEUTRAL, HOSTILE]
-- radius - area around the player to search for entities
widget.setTrackingFilter(String:type, Integer:metaindex)
-- type - item/creature name
-- metaindex - metadata used for items/blocks
widget.setTrackingEntity(String:uniqueid)
-- uniqueid - entitys unique id
-- sets the uuid for the unique filter, "none" or empty String disables the filter-- this example is part of the openglasses demo lootdisk, which is available ingame
-- load some mesh as marker
fh = io.open("/usr/wavefrontObjects/cubeMatrix.obj", "r")
wavefrontObj = fh:read("*a")
fh:close()
-- load glasses terminal and remove old widgets
glassesTerminal = require("component").glasses
glassesTerminal.removeAll()
-- add a entity tracker which filters for living creatures
entityTracker = glassesTerminal.addEntityTracker3D()
entityTracker.loadOBJ(wavefrontObj)
entityTracker.setTrackingType("living", 32)
entityTracker.addTranslation(0, 0.5, 0)widget.setTrackingType("NEUTRAL", 32)
-- tracks all neutral entities in a radius of 32 blocks (players and animals)widget.setTrackingFilter("sheep")
-- searches for sheeps in a radius of 32 blockswidget.setTrackingType("ITEM", 32)
widget.setTrackingFilter("minecraft:cobblestone", 0)
-- searches for cobblestone items on the groundwidget.setTrackingType("ALL", 32)
-- tracks everything in a radius of 32 blocks