Hello Guest

Author Topic: Pixel alignment issue with camera  (Read 3385 times)

fsadeq

  • 2D Toolkit
  • Sr. Member
  • *
  • Posts: 353
    • View Profile
Pixel alignment issue with camera
« on: April 04, 2014, 05:13:01 pm »
Hello, I'm working on a pixel perfect game and have a camera that follows the player. I used to use a 1:1 pixel projection ratio - but things were getting too massive to work with, so I recently switched to a 1:64 projection. Everything is working great, except now when the camera moves or smooth follows the player, the tiles are sometimes slightly distorted because of what I'm assuming is the camera sitting on half pixels sometimes. I fixed this before by just rounding the values, but since now the scale is way smaller I can't round any of the positions. Are there any suggestions on what to do about this? Thanks.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Pixel alignment issue with camera
« Reply #1 on: April 06, 2014, 12:14:41 pm »
You just need to round to 1/64 of a pixel, instead of 1 pixel. Eg. round(pos.x * 64) / 64.