Kangaroo

THIS FORUM IS NO LONGER ACTIVE. PLEASE POST ANY NEW QUESTIONS OR DISCUSSION ON:

https://discourse.mcneel.com/c/grasshopper/kangaroo

The discussions here are preserved for reference, but new questions posted here are likely to go unanswered.

Kangaroo is a Live Physics engine for interactive simulation, optimization and form-finding directly within Grasshopper.

How to find current forces applied to particles

When a system has goals still trying to move particles, but has reached equilibrium, I'd like to gather information about what forces are being applied on each particle by each goal. Is there a way to query the solver for this? I imagine it's right there somewhere in the API, but I don't know which object/method to access. 

  • up

    Daniel Piker

    Hi Cory,

    I just put an example script here:

    https://github.com/Dan-Piker/Kangaroo-examples/commit/8f0403dcb0f85...

    That lets you see the vectors applied to each particle and which goals they come from as you step through the simulation

    Related to how the solver works, the vectors shown here are actually the 'move' vectors, and the numbers are the weightings. To get forces, you would multiply each move by its respective weighting value.

    • up

      Cory

      Thanks - this is useful. I wasn't able to get the main component to output anything, but rewrote it in python for my own purposes and all the calls seem to work. Using a custom iterator to drive kangaroo will definitely provide the control I've been struggling to find with custom goals. I'm now hoping to reimplement BouncySolver while leaving hooks to inspect or modify the system at each iteration. I have some questions about the API:

      • GetAllMoves() is returning vectors here after a reset but without any steps applied. At what point are goals' Calculate methods being called?
      • How does SimpleStep differ from Step?
      • Is there a call to check for convergence, or does the GH solver module do that itself?

      1