# Makie: Linked camera of 3d plots go out of sync on slider change

**URL:** <https://discourse.julialang.org/t/makie-linked-camera-of-3d-plots-go-out-of-sync-on-slider-change/123837>\
**Category:** Visualization\
**Created:** [December 14, 2024, 8:57am UTC](https://discourse.julialang.org/t/makie-linked-camera-of-3d-plots-go-out-of-sync-on-slider-change/123837 "2024-12-14T08:57:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanjeev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sanjeev/32/212058_2.png) [@sanjeev](https://discourse.julialang.org/u/sanjeev)\
**Post date:** [December 14, 2024, 8:57am UTC](https://discourse.julialang.org/t/makie-linked-camera-of-3d-plots-go-out-of-sync-on-slider-change/123837/1 "2024-12-14T08:57:12Z")

</div>

I have a figure with two LScenes and a slider which is used to change data in the scenes. I have linked the cameras in the two LScenes, using the method shown in [this post](https://discourse.julialang.org/t/makie-linking-cameras-in-multiple-3d-plots/83309). The problem is that when I change the slider one of the camera gets reset. Here is the MWE,

```julia
using GLMakie

npts = 100
n = 10
pts_1_series = [rand(Point3f, npts) for _ in 1:n]
pts_2_series = [rand(Point3f, npts) for _ in 1:n]

fig = Figure()
l1 = LScene(fig[1,1], scenekw=(;center=false))
l2 = LScene(fig[1,2], scenekw=(;center=false))

sg = SliderGrid(fig[2,:][1,1], (label="n", range=1:n, startvalue=1), width=350, tellwidth=false)

pts_1 = @lift pts_1_series[$(sg.sliders[1].value)]
pts_2 = @lift pts_2_series[$(sg.sliders[1].value)]

scatter!(l1, pts_1)
scatter!(l2, pts_2)

link_cameras_lscene(f; step=0.01) = begin
    scenes = filter(x -> x isa LScene, f.content)
    cameras = map(x -> cameracontrols(x.scene), scenes)

    for i ∈ 1:length(cameras)
        on(cameras[i].eyeposition) do eye
            for j ∈ 1:length(cameras)
                i == j && continue
                if sum(abs, eye - cameras[j].eyeposition[]) > step
                    update_cam!(scenes[j].scene, cameras[i])
                end
            end
        end
    end
    f
end

fig = link_cameras_lscene(fig; step=0.1)

```

Any idea how I can stop the cameras from updating on slider change?

---

<div class="post-metadata">

**Author:** ![sanjeev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sanjeev/32/212058_2.png) [@sanjeev](https://discourse.julialang.org/u/sanjeev)\
**Post date:** [December 15, 2024, 4:26am UTC](https://discourse.julialang.org/t/makie-linked-camera-of-3d-plots-go-out-of-sync-on-slider-change/123837/2 "2024-12-15T04:26:43Z")

</div>

I’ve trying to understand why this happens. I think it happens because after the slider change, `update_state_before_display!(f::FigureAxisPlot)` is called somewhere, which calls `reset_limits!(ax)` on all its scenes.

Does anyone know how I can prevent this “update” from happening on slider change?
