Skip to main content
1 of 4
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259

I would take a different approach. I wouldn't use locators to add more particles to the simulation; rather I would use a ClickPane. Nor would I use a slider to generate update events; rather I would use a Button

Manipulate[
  If[update, update = False; pts = updater[]];
  ClickPane[
    Framed@Graphics[{Blue, PointSize[0.02], Point[pts]}, PlotRange -> {{-5, 5}, {-5, 5}}], 
    AppendTo[pts, #] &],
  {{update, False}, ControlType -> None},
  {{pts, {{0, 0}}}, ControlType -> None},
  Button["Update", update = True],
  Initialization :> (
    vels[n_] := RandomReal[{-1, 1}, {n, 2}];
    updater[] := (pts = MapThread[(#1 + #2) &, {pts, vels[Length@pts]}])
  )]

manipulate

Give it a try and see if it satisfies your needs.

m_goldberg
  • 108.1k
  • 16
  • 104
  • 259