# FollowCamera.cameraAcceleration not working properly

**URL:** <https://forum.babylonjs.com/t/followcamera-cameraacceleration-not-working-properly/42112>\
**Category:** Bugs\
**Tags:** camera\
**Created:** [July 3, 2023, 1:39am UTC](https://forum.babylonjs.com/t/followcamera-cameraacceleration-not-working-properly/42112 "2023-07-03T01:39:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alecell](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/alecell/32/18099_2.png) [@Alecell](https://forum.babylonjs.com/u/Alecell)\
**Post date:** [July 3, 2023, 1:39am UTC](https://forum.babylonjs.com/t/followcamera-cameraacceleration-not-working-properly/42112/1 "2023-07-03T01:39:26Z")

</div>

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](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](https://forum.babylonjs.com/t/weird-shadows-on-follow-camera/38389)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [July 3, 2023, 8:13am UTC](https://forum.babylonjs.com/t/followcamera-cameraacceleration-not-working-properly/42112/2 "2023-07-03T08:13:06Z")

</div>

cc @PolygonalSun

---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [July 5, 2023, 10:26pm UTC](https://forum.babylonjs.com/t/followcamera-cameraacceleration-not-working-properly/42112/3 "2023-07-05T22:26:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Alecell](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/alecell/32/18099_2.png) [@Alecell](https://forum.babylonjs.com/u/Alecell)\
**Post date:** [July 5, 2023, 11:35pm UTC](https://forum.babylonjs.com/t/followcamera-cameraacceleration-not-working-properly/42112/4 "2023-07-05T23:35:54Z")

</div>

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:

[https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/4/a/4aab790ff0cd4d1e1c44b2e1fd75a5c5809a1b7d.mp4](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/4/a/4aab790ff0cd4d1e1c44b2e1fd75a5c5809a1b7d.mp4)

Thats what I have on my camera module:

```ts
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.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [July 6, 2023, 4:25pm UTC](https://forum.babylonjs.com/t/followcamera-cameraacceleration-not-working-properly/42112/5 "2023-07-06T16:25:16Z")

</div>

Assigned @PolygonalSun on July 6, 2023, 4:25pm UTC


