I am attempting to create a radar system, it already displays positions of detected objects on a display but I need to be able to rotate those positions around the center by the rotation of the display.
I have researched this problem but any details I could find online didn't function properly and caused more problems.
...
for i, ship in ipairs(scan) do
local xOffset = currentPos['x'] - ship['position']['x']
local zOffset = currentPos['z'] - ship['position']['z']
--Rotate xOffset and zOffset around center (0,0)
local drawX = xMiddle + xOffset
local drawZ = zMiddle + zOffset
paintutils.drawPixel(drawX, drawZ, colors.blue)
local textLen = string.len(ship['mass'])
local textStart = drawX - textLen/2
term.setCursorPos(textStart, drawZ-1)
term.write(ship['mass'])
end
...