All of my sprites are 32x32 pixels. A
camera is following my player and
everytime my player is moving, the
other sprites that are seen in the
camera are shaking/shuddering. When my
player is moving up, the sprites are
shaking up and down.I already have all my shaders pixel
snapped. I’ve also tried it without
pixel snapping. I also tried making my
sprites Bilinnear, Trillinear, and
Point, and none of those three fixed
the problem.I’m also not using a code for my
camera to follow the player. I just
have my player as the parent of the
camera, so the player is always pixel
perfect even when I’m moving since I’m
always at the center, but the other
sprites around me are shuddering.My player moves with
rigidbody.velocity. And it works just
fine with my player. EDIT: My player
moves with rigidbody2D.velocity.edit/additional info: The shaking only
appears on the sprites that are not
moving. The other sprites around me
(the non-player sprites) have a code
that makes them move by themselves.
Whether the player/camera is moving or
not, the sprites who are moving with
rigidbody.velocity (the same as my
player’s) doesn’t shake or jitter.I’ve googled EVERYWHERE about my
problem, and NONE worked so far. The
sprites around the player just keeps
jittering when the player/camera is
moving.Please help. My boss is going to fire
me and murder me afterwards for
wasting his time. I hope I explained
everything clearly. Thanks!ANOTHER EDIT:
I tried to use this function:
public static float RoundToNearestPixel(float unityUnits,
Camera viewingCamera)
{
float valueInPixels = (Screen.height /
(viewingCamera.orthographicSize * 2))
- unityUnits;
valueInPixels = Mathf.Round(valueInPixels);
float adjustedUnityUnits = valueInPixels / (Screen.height /
(viewingCamera.orthographicSize * 2));
return adjustedUnityUnits;
}With this code in the Update()
function:Vector3 roundPos = new Vector3(RoundToNearestPixel(p.transform.position.x,
Camera.main),RoundToNearestPixel(p.transform.position.y,
Camera.main),-31);
transform.position = roundPos;And the sprites around me stopped
shaking! BUT then, it was my player
now that started shaking. Everytime I
move, my player started to shake just
like how the other npcs around me
shaked without that code above. How
can I fix this? I want all sprites to
stop shaking when I’m moving.And yeah, I think I know why it’s
shaking, because I know how the code
above works. It’s just that I don’t
know how to fix it.NEW EDIT/UPDATE: I somehow made the
shaking of my player less visible by
having its shader pixel-snapped. But
it’s still there. And when I’m moving
left or right, there are black lines
that appear and disappear at the end
of his face. So his face grows longer
in width with that black line and goes
back to original everytime I move.So yeah, it’s clearly less visible
when I pixel snap it, but it’s still
there.Thanks :)*
EDIT:
Nevermind guys. My employer just randomly decided to find another programmer. (In other words, he fired me.) So I guess I won’t need an answer for this problem anymore. But still, thanks for all your time and help!