In Nixie Tubes I (and GopherATL before me) used a car entity that rotates to display the characters. While extending this to alphabetic characters I found that with a large number of sprite slots the rotations are not spaced evenly around a circle, and some had to be offset ahead/behind their expected position.
See stateOrientMap in this file for the example offset rotations.
			
			
									
									
						Rotation sprite slots not evenly spaced
- 
				justarandomgeek
 - Filter Inserter

 - Posts: 304
 - Joined: Fri Mar 18, 2016 4:34 pm
 - Contact:
 
Re: Rotation sprite slots not evenly spaced
Hi, it is not a bug.
Factorio uses orthogonal projection with camera tilted by 45°, which causes cicles become ellipses.
You can use something like following to solve your issue:
EDIT: Fixed sign in math.atan2.
			
			
									
									
						Factorio uses orthogonal projection with camera tilted by 45°, which causes cicles become ellipses.
You can use something like following to solve your issue:
Code: Select all
local function projected_orientation(turn)
  local x = math.sin(turn * math.pi * 2)
  local y = -math.cos(turn * math.pi * 2)
  y = y * math.cos(math.pi / 4)
  return math.atan2(x, -y) / (math.pi * 2)
end
local stateOrientMap = {
  { 
  ["0"]=projected_orientation(bigstep*0),
  ["1"]=projected_orientation(bigstep*1),
  ["2"]=projected_orientation(bigstep*2),
  ["3"]=projected_orientation(bigstep*3),
...
- 
				justarandomgeek
 - Filter Inserter

 - Posts: 304
 - Joined: Fri Mar 18, 2016 4:34 pm
 - Contact:
 
Re: Rotation sprite slots not evenly spaced
That makes perfect sense - I'd suspected it was some kind of distortion of the circle based on the 'error' pattern. In my case it's just a lookup table, so fudging the numbers "close enough" is good enough for me, but if I ever need to calculate rotations on the fly (or make another table...) I'll definitely do it that way!
			
			
									
									
						