2
\$\begingroup\$

As the title says, I have a character that moves at sub pixel movement (no, I can't change this, because this sub pixel movement happens when I normalize the vector during diagonal movements, otherwise it would move faster) and the camera follows it. The problem as you can see from this video, is that the textures of the various tiles kinda go crazy: https://files.catbox.moe/ve6t0h.webm

This is my camera:

   CameraPos = target.Position + Movement;
        Matrix mPosition = Matrix.CreateTranslation(-CameraPos.X, -CameraPos.Y, 0);

        CameraOffset = CenterOfScreen - target.Origin;
        Matrix mOffset = Matrix.CreateTranslation((CameraOffset.X / Game1.Scale.X), (CameraOffset.Y / Game1.Scale.Y), 0);

        var zoom = Matrix.CreateScale(new Vector3(Game1.Scale.X, Game1.Scale.Y, 1));

        Transform = mPosition * mOffset * zoom;

target.Position is the Position of my character, it can be sub-pixel. Movement is the movement of the mouse in relation to my character, also can be sub-pixel.

The Sampler.State I'm using is PointClamp, I really don't want to use the linear one, I don't want blurriness.

I've already tried truncating/rounding the position values in the camera, but the result is a very annoyingly shaky camera which I don't want.

Please help, this is driving me crazy.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.