Skip to content

Conversation

hbsmith
Copy link
Contributor

@hbsmith hbsmith commented May 20, 2025

Currently 3D hover inspection is broken.

Minimal non working example:

using Agents, Plots, Random, GLMakie

@agent struct Dummy(ContinuousAgent{3,Float64}) 
     speed::Float64
end

function setup(;
    n_agents = 100,
    extent = (100, 100, 100),
)
    space3d = ContinuousSpace(extent)
    model = StandardABM(Dummy, space3d; agent_step! = agent_step,
                        container = Vector, scheduler = Schedulers.Randomly(), rng = Xoshiro(314))
    for _ in 1:n_agents
        add_agent!(model,(1.,1.,1.),1.)
    end
    return model
end

function agent_step(dummy, model)
    move_agent!(dummy, model, dummy.speed)
end

model=setup()

fig, abmobs = abmexploration(model; agent_size=3)

fig
Screenshot 2025-05-20 at 11 56 11

Note that there's a visible arrow but none of the default inspection information.

I don't have a great understanding of Makie, but it seems like the issue had something to do with the way the position was being translated, and thus never recognizing any Agents in the position of the mouse. The changes I made fix this as minimally as I was able to, such that it avoids Bounds errors, and displays information of multiple agents if they're in the same position.

With the fix:
Screenshot 2025-05-20 at 11 55 26

If someone thinks there's a better way to do this, be my guest, but at least it works nows.

Note that this should be merged after #1159

@codecov-commenter
Copy link

codecov-commenter commented May 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.27%. Comparing base (8b5b456) to head (ed567a0).
Report is 187 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1162       +/-   ##
===========================================
+ Coverage   70.12%   85.27%   +15.14%     
===========================================
  Files          42       38        -4     
  Lines        2718     2614      -104     
===========================================
+ Hits         1906     2229      +323     
+ Misses        812      385      -427     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Tortar
Copy link
Member

Tortar commented May 28, 2025

I'm wondering: isn't idx already agent_idx? we should really try to avoid collect(allids(model))

@Tortar
Copy link
Member

Tortar commented May 28, 2025

Nice work by the way :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants