This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
SuspiciousWatermelon's profile picture

Augmented Reality and Advanced Player Detection

Started by SuspiciousWatermelon, 06 July 2013 - 09:04 AM
SuspiciousWatermelon #1
Posted 06 July 2013 - 11:04 AM
Title: Augmented Reality and Advanced Player Detection

I play on a small private server with friends I trust. We have just found out about OpenPeripheral's Terminal Glasses and are excited about the potential. We have an idea to make an 'augmented reality' system, which could do some cool things, for example:
  • Overlay information about what you're looking at
  • Create a shared waypoint system, with waypoint information stored on the server on a computer
But the issue is that we need a reliable way to always know the position and orientation of a player. Something like OpenCCSensor's Proximity Sensor Card would be ideal (as it provides X, Y, Z, Yaw, Pitch, and YawHead methods), but we were looking for something that can provide that without a range constraint, and can also work across worlds. Yes, this would normally be overpowered, but we aren't too worried about that!

tl;dr Is there a peripheral that can provide player positions and orientations without a range constraint?
theoriginalbit #2
Posted 06 July 2013 - 11:35 AM
No, OpenCCSensors is the only way to do it, and it has range constraints.
LNETeam #3
Posted 06 July 2013 - 04:39 PM
You can use immibis peripherals and use the Adventure Interface. You can even find direction you are looking at, location, even entities and convert entities to other worlds and things, it's pretty cool

Example:

a = peripheral.wrap("left")
c = peripheral.wrap("right")
while true do
  p = {os.pullEvent()}
  if p[1] == "chat_message" then
    cmd = string.gsub(p[3],"&","")
    if cmd == "exl" then
	  print("Exploding: "..p[2])
	  pl = a.getPlayerByName(p[2])
	  ent = pl.asEntity()
	  x,y,z = ent.getPosition()
	  w = a.getWorld(0)
	  w.explode(x,y,z,.5,false,false)
    elseif cmd == "he" then
	  print("Healing: "..p[2])
	  pl = a.getPlayerByName(p[2])
	  pl.heal(20)
    elseif cmd == "tp home" then
	  print("Transporting: "..p[2])
	  pl = a.getPlayerByName(p[2])
	  ent = pl.asEntity()
	  ent.setPosition(1471.1,105,-710.1,0)
    --[[elseif cmd == "crchest" then
	  w = a.getWorld(0)
	  pl = a.getPlayerByName(p[2])
	  ent = pl.asEntity()
	  x,y,z = ent.getLooking()
	  w.setBlock(x,y+1,z,54,0)
	  local te=w.getTileEntity(x,y+1,z)
	  local nbt = te.readNBT(te)
	  table.insert(nbt.value.Items.value, {type="compound", value={id={type="short", value=1}, Count={type="byte", value=64}, Damage={type="short", value=0}, Slot={type="byte", value=0}}})
	  writeTileNBT(te,nbt)
	  print("Creating chest at "..x..""..y..""..z)--]]
    end
  end
end
SuspiciousWatermelon #4
Posted 06 July 2013 - 05:37 PM
You can use immibis peripherals and use the Adventure Interface. You can even find direction you are looking at, location, even entities and convert entities to other worlds and things, it's pretty cool

That sounds exactly like what I'm looking for. Thanks a lot!
theoriginalbit #5
Posted 06 July 2013 - 08:58 PM
You can use immibis peripherals and use the Adventure Interface.
I though that had a range limit smaller than OCS?! Oops my mistake, sorry OP.
frostthejack #6
Posted 23 September 2013 - 02:08 PM
could you please post a snippet of your code if you get it working would love to take a look at it