FollowCamera.cameraAcceleration not working properly

Hey all, I was working with FollowCamera but I figured out a issue that camera position flicks every frame when I set a cameraAcceleration value. https://playground.babylonjs.com/#FLAB0U#1

I also notice that, even when I dont add cameraAcceletarion value, it stills flickering, but only when my character moves.

I think thats a bug, but lemme know if I’m using Follow Camera in a wrong way!

The issue seems like the same one as I faced before: Weird "shadows" on follow camera

cc @PolygonalSun

While I’m not too familiar with the follow mechanic of the FollowCamera, from what I’m seeing, the flickering behavior is coming from the camera quickly hopping between two points, one that is less than the camera’s radius and one that is greater. The FollowCamera’s radius acts as a goal or desired value and the acceleration value is used to inch towards this value. With a small value for the acceleration, this should be achievable. I noticed that you’re using a value of 1 for cameraAcceleration so the camera ends up hopping between two values whose distance from the radius is less than the velocity. I’ll have to ask around about the math, just to make sure that I’m not misinterpreting anything. In any case, I’d recommend using some very small number (maybe something like 0.005?), depending on what your goal camera radius will be (default is 12). If I get any more info, I’ll update this thread.

1 Like

Hey, I tried, but even with its default config it got the issue, it don’t happen when I’m idle, but when I move it happens:

Thats what I have on my camera module:

export class Camera {
  constructor(mesh: Mesh, scene: Scene) {
    const camera = new FollowCamera("Camera", new Vector3(0, 10, -10), scene);
    camera.lockedTarget = mesh as AbstractMesh;
    scene.activeCamera = camera;
  }
}

EDIT: Here is WAYYY faster than what we got on the video, the thing is that the recorder can’t follow the camera speed, but the camera is moving at the same speed as the playground I provided.