Hello,
I’m having an issue where the background is jiitery while camera is following the player. The character is correctly displayed (no blurry no jitter).
I’ve tried many solutions but nothing works. The jitter is still present.
Here is my player movement script :
private float move;
public bool controlsEnabled;
Rigidbody2D rigidbody2d;
private float maxSpeed = 5f;
void Update()
{
if (controlsEnabled) {
move = Input.GetAxis("Horizontal");
}
}
private void FixedUpdate() {
rigidbody2d.velocity = new Vector2(move * maxSpeed, rigidbody2d.velocity.y);
}
I’m using pixel perfect camera > 32 PPU (ref res X 480 Y 320)
Cinemachine brain with Fixed Update for the Update Method. (with cinemachine pixel perfect extension)
All sprites are imported with good practices for 2D pixel art, I mean Point (no filter) etc…
Here is my parallax script for the background :
public class Parallax : MonoBehaviour {
private float length, startpos;
public GameObject cam;
public float parallaxEffect;
// Start is called before the first frame update
void Start() {
startpos = transform.position.x;
length = GetComponent<SpriteRenderer>().bounds.size.x;
}
// Update is called once per frame
void FixedUpdate()
{
float temp = (cam.transform.position.x * (1 - parallaxEffect));
float dist = (cam.transform.position.x * parallaxEffect);
transform.position = new Vector3(startpos + dist, transform.position.y, transform.position.z);
if (temp > startpos + length) startpos += length;
else if (temp < startpos - length) startpos -= length;
}
}
I’ve tested pixel perfect camera version 2.0.3 & 3.0.2.
Did anyone meet the same issue ?
Thanks