my background parallax is getting messed up because of Cinemachine’s damping. I couldn’t figure out why/how to fix it.
26s3io
It occurs right at the end of the movement, when the camera’s catching up to the new position due to the damping. Notice the trees jitter.
Here’s the parallax script:
{
public Transform cam;
public float relativeMove = .3f;
public bool lockY = false;
private void FixedUpdate()
{
if(lockY){
transform.position = new Vector2( cam.position.x * relativeMove, transform.position.y);
}else{
transform.position = new Vector2( cam.position.x * relativeMove, cam.position.y * relativeMove);
}
}
}```
The virtual camera's using a framing transposer, the camera brain is using SmartUpdate for its update and late Update for its Blend update method.
Player object's got no interpolation (I've tried all previously mentioned methods of using interpolation or not - doesn't work), player's movement is in Update, uses velocity.
I read something about clamping pixels but I couldn't get it to work. My sprite's PPU is 32.
Any help will be appreciated - this has been driving me up the wall for the last few days.
You are probably reading the camera’s position before it gets set. Cinemachine updates the camera as late as possible in the frame. You need to read the transform after that happens. Try setting your script execution order to be after CinemachineBrain.
Circling back on this issue - I was able to resolve it by setting the Blend Update Method to Fixed Update (previously Late Update) in my CinemachineBrain. My parallax calculations were done in the Update function of my parallax script.
If that works for you, ok, but it doesn’t sound like the correct solution. Instead, you should move your parallax calculations to be done later in the frame, after the Brain’s LateUpdate.
thank you.I set the parallax script order to be after all cinemachine scritps,set palyer’s rigidbody2d interpolate on,move parallax sprite code to LateUpdate,finally get a acceptable outcome, still a little jitter for the very far parallax though.