wiki:computronics:camera
                no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
| — | wiki:computronics:camera [2015/06/25 15:59] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Camera ====== | ||
| + | The **Camera** lets you gather information (specifically, | ||
| + | |||
| + | ===== Recipe ===== | ||
| + | |||
| + | **NOTE:** The stone bricks on top can be any type of stone bricks. | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | ===== API ===== | ||
| + | |||
| + | ==== Redstone ==== | ||
| + | |||
| + | Since 0.1.4, you can hook up a redstone wire to the camera to get distance data - the energy level reflects the distance (15 - 0-1 blocks away, 14 - 2-3 blocks away, ...., 1 - 30-31 blocks away). | ||
| + | |||
| + | ==== OpenComputers/ | ||
| + | |||
| + | ^ Command ^ Added in ^ Description ^ Usage ^ | ||
| + | | distance([x, | ||
| + | |||
| + | === Robot Camera Upgrade-specific ==== | ||
| + | |||
| + | ^ Command ^ Added in ^ Description ^ | ||
| + | | distanceUp([x, | ||
| + | | distanceDown([x, | ||
| + | |||
| + | ==== NedoComputers ==== | ||
| + | |||
| + | ^ Address ^ Read ^ Write ^ | ||
| + | | 0x00 | X direction (-32768 - 32767 == -1.0 - 1.0) | X direction | | ||
| + | | 0x02 | Y direction | Y direction | | ||
| + | | 0x04 | Distance, measured in 1/64ths of a block. | - | | ||
| + | |||
| + | ==== Examples ==== | ||
| + | |||
| + | === ComputerCraft ray caster === | ||
| + | |||
| + | < | ||
| + | local array = " ., | ||
| + | local monitor = peripheral.wrap(" | ||
| + | local yp = 1 | ||
| + | monitor.clear() | ||
| + | monitor.setTextScale(0.5) | ||
| + | monitor.setCursorPos(1, | ||
| + | |||
| + | for j = -0.35, | ||
| + | for i = -1,1,0.036 do | ||
| + |     local d = camera.distance(i, | ||
| + | local a = 1 | ||
| + | if d > 0 then a = 2 + (8 - math.min(8, (d/1.2))) end | ||
| + |     monitor.write(string.sub(array, | ||
| + | end | ||
| + | yp=yp+1 | ||
| + |   monitor.setCursorPos(1, | ||
| + | end</ | ||