Elastic collision for particle pairs in 3d EventQueueABM model

Hello everyone,

I’m trying to make a model where 2 particles in 3d cubical space when comes to certain distance they do elastic collision. Now major issues are that

  1. Elastic collision function is just for 2d in Agents.jl
  2. Also finding interaction pairs is not possible in EventQueueABM as it doesn’t have scheduler which is required in interaction_pair() function.

So, at the moment I was thinking that may be something like this can be done.

function something(agent, model)
      r = 0.01
    a1 = agent
    a2 = nearest_neighbor(a1, model, r)
    
    if typeof(a2) != Nothing
        elastic_collision!(a1, a2, :mass)
    end

end

Is it in right direction ? Any suggestion will be helpful :slight_smile: