Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BoundsError when inspecting agents in 3D visualisation #1040

Open
jdm204 opened this issue May 26, 2024 · 0 comments
Open

BoundsError when inspecting agents in 3D visualisation #1040

jdm204 opened this issue May 26, 2024 · 0 comments
Labels
bug Something isn't working plotting

Comments

@jdm204
Copy link

jdm204 commented May 26, 2024

Describe the bug
Indexing error when inspecting agents (enable_inspection = true) in abmplot etc for 3D models.

BoundsError: attempt to access 10×10×10 Array{Int64, 3} at index [0, 0, 0]

Minimal Working Example

@agent struct A3D(GridAgent{3}) end

function simple3d_step!(model)
    has_empty_positions(model) || return
    agent = random_agent(model, notsurrounded(model))   
    newpos = rand(abmrng(model), collect(empty_nearby_positions(agent, model)))
    add_agent!(newpos, model)
end

function init_simple3d(;
    dims = (10, 10, 10),
    model_step! = simple3d_step!)
    space = GridSpaceSingle(dims)   
    model = StandardABM(
        A3D,
        space;
        model_step!)
    add_agent!(dims .÷ 2, model)
    model
end

function simple3d_exploration()
    model = init_simple3d()
    abmplot(model;
        enable_inspection=true)
end
f, _ = simple3d_exploration(); f
# mouseover the agent

Agents.jl version

Agents.jl 6.0.12

@Datseris Datseris added bug Something isn't working plotting labels May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working plotting
Projects
None yet
Development

No branches or pull requests

2 participants