Intro
In grasshopper field, there’re some useful and famous plug-ins for phyiscal simulation. Just to mention a few, Kangaroo, Flexhopper,… and etc.
I always think it’s more fun to play around the modelling which mimic the realistic phyiscal behaviours. This post is for noting down some developers’ thoughts while developing the phyiscal simulation tools.
And again this amazing tutorial is from Professor. Jose
.
Here’s the link:
https://www.youtube.com/watch?v=kG-AxzMPjxk&t=5311s
Also, one important concept before doing simulations would be iteration
.
Iteration
Usually, the physic behaviors are related to time, meaning it’s a function of time.
In code, we need to make sure the result of previous round can be brought to the next round.
Might be seen something like this.
1 | NextRound += PreviousRound; |
Iteration In C# script Component
https://www.youtube.com/watch?v=ek2iL88WqGQ&t=497s
Professor Jose well explained the scope
of the variables in C# script component, which is one of the vital ingredient before you do any simualtion related to time.
Code
Here I would like to share one of the example in this tutorial.
1 | private void RunScript(bool reset, Point3d anchorPoint, Point3d startPoint, double radius, Vector3d gravity, double stiffness, double friction, ref object L, ref object S, ref object P, ref object V) |