I have recently noticed that when I move the camera in my project, it is cause objects to jitter.
I was thinking of the obvious and did round the camera position to make sure it is not trying to draw on to sub pixels but it doesn't help.
This is what it looks like:
This is the code
One thing to note is that in my system each object store a reference to its camera so I can have multiple cameras, a different camera for every object if I want to. But in this case I have only 1 camera for all objects.
object draw call:
Code: Select all
t.draw = function(self)
self.camera:start()
love.graphics.setColor(self.r,self.g,self.b,self.a)
love.graphics.draw(self.image, self.x, self.y, self.rotation, self.scaleX, self.scaleY, self.originX, self.originY)
self.camera:stop()
end
Code: Select all
t.start = function(self)
love.graphics.push()
--translation uses reversed coordinates so it has to be negative to get positive effect
--camera is centered on the object
love.graphics.translate(-self.x + getResolutionWidth()/2, -self.y + getResolutionHeight()/2)
end
t.stop = function(self)
love.graphics.pop()
end
Code: Select all
t.setPosition(self, _x, _y)
self.x = _x
self.y = _y
end
Thanks.