Grasshopper - Intoduction to Kangaroo

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys in this tutorial we're going to take our first look at kangaroo for grasshopper if you don't have kangaroo you can get it from the food for rhino website just go to food for aina and then you come down here to grasshopper add-ons and it should be under most download in fact it looks like it is the most downloaded plugin alright cool so let's say you've got that and you've loaded it up let's let's begin to look at what it is what is kangaroo for starters aadmi kangaroo is a physics engine for grasshopper it allows us to do simulations so any sort of kangaroo simulation that you want to do has to use this kangaroo physics object this is this is the processing power of kangaroo so it takes a couple of inputs it takes four subjects and so four subjects are anything that you can find in this tab as well as a couple of custom ones that have been made over here um we we also have um your anchor points sort of any pieces of geometry that you want to stay completely fixed your settings are if you do want to change anything or any thing about how the solar works we do have this component which allows us to change any of those numbers and we'll answer then anything that you any sort of geometry that you are working with you plug straight into here in the geometry tab and your simulation reset obviously resets simulation so let's let's just set up a dummy simulation to see how we would actually use this I'm just going to bring in a center box and let me just make that a bit bigger plug in the slider and I'm just going to up the values on this so here's my box um there should not that kangaroo only works well I don't say only kangaroo kangaroo works with me geometry and curved geometry as the input there are some special cases in which you can you can set up say collisions with what do we have with the lightest of all you could do like a surface collision um but any geometry feeding in here has to be a match because mesh is a Phi is eager to compute and that's what a that's what kangaroo deals with so I'm going to take this box now and I'm going to turn it into a mesh box then we'll hook that up and I'm going to track down a slider for my divisions over here and I'm going to set this to I'll you know I'll set it to a maximum of 20 and then I'll plug that into my XY and Z and we'll shift that number up alright cool so now I'm going to preview these off I'm going to plug them into my I'm going to plug the mesh box into my geometry tab over here and now we're going to laid out some four subjects so one of the most common four subjects that you'll use in virtually every single definition is the springs object Springs basically define um how this how your surface works basically the underlying tension and well the stiffness um the rest length these these are all sort of key material properties of your mesh that you can that you can work with and integral with so the first thing you need um is a connection to a connection is just a line and so in order to get a line um I prefer okay for this I would also recommend that you get the weaverbird component because we've Bert has this really good component which is called weaverbird mesh edges which will just output all your edges in the and the mesh and then you can plug that into your connection and then we should also have plug in a all basically that's the only thing you need to plug in anything else is a sort of an additional input so we could also plug in a something here for the rest length because I might want to tweak that just so that we can see what we could actually do with this kangaroo plug in to run a simulation so what I'm going to do is I'm going to take the length of each of these curves using my length component and I'm going to multiply it by the slider over here and I'll just set that slider to 1 and then plug it into my rest length all right so then my what my springs and any sort of force object outputs is some sort of force of some some sort so you can see out here we get we get this spring force and so that will just go into our force objects into this component over here and then we can see our mesh is now changed because suddenly it's recognizing a whole lot more inputs so I feel that's working for me um the last few things I need to get simulation running are a boolean and a timer so the timer you buy the time as a special kind of component because you don't plug it into your own plug it into anything the usual where you drag on this this arrow over here and then you just connect it up to the bottom of this solver component the time is used exclusively for any kind of salvage um or any kind of solver objects there's a there's not many but a kangaroo is one of them and then we can change sort of the update interval and one second is going to be far too slow for me so I'm going to take it all the way down to 20 milliseconds and then I'm going to plug this boolean in and so will how this works is this is asking should the simulation be reset if you say if you have true over here then the simulation is never going to actually play out so as soon as you set this to false the simulation is now actually running you won't notice anything immediately just because our our mesh is currently resting at a at a state that it originally was in so what we're also going to do is we're all just going to plug a take out our output of this geometry out with a mesh so that we can turn off this preview off this kangaroo physics object which will hide all our points and lines and everything that would otherwise be getting in the way cool so now this is running and as soon as I play around with the slider you should see some changes so you can see now I will just reset the simulation as soon as I change this value over here it started to have an effect on my mesh and that's I mean that's the basics of how kangaroo works all right so now let's let's mix this up a little bit um I mean that's all well and good we're basically just crushing that mesh box over there but I mean that's we can do a lot more than that so I'm going to get rid of that and I'm going to know what I'm actually going to do is I'm going to replace this boolean toggle with a button I prefer to use a button because this um this button has outlets it's false until you press it which means that moment you press it it resets simulation and then it keeps going which i think is pretty neat we can just I mean it's a it's a little bit easier yeah all right so we're going to take this box that we created over here and we're going to deconstruct it so that we can get a list of vertices which we're going to plug into our and replace so i anchor point to any geometry items that we want to stay fixed we don't want them to move so now watch as I hit this button you'll see these corner points the points were the sort of corner points of my box they're all staying completely fixed and I can pull the slider right down and what we're basically gonna get is a box in complete tension and so that's that's a pretty neat result you can see that's that's our output um you should also notice at this stage that um we are getting this weird sort of um thing happening where we have it where we have defined edges um right along here and that happens on every single side and that's basically because of the way um the mesh is constructed so if I were to bake out this mesh you can see that the edges along here are very defined and that's because um graphs are grasshopper and Reinert they sort of read this collection of faces as one group of faces and then this collection of faces over here is one group of faces meaning that along this edge um or basically the the information the edge information does not sort of smooth over which is all well and good for a cubical mesh but for this mesh coming out of kangaroo I mean that's not exactly what we want so the fix is really simple we just use a mesh weld vertices component um this is a custom component which comes from a plugin called boot or measured it it's one that I use a lot and you should be using two if you're working with Misha's a lot in grasshopper you'll see as soon as we bake that we get that nice smoothing out of our of the details of our edges of our mesh alright cool so that's that's enough that let's say let's see what else we can do with this simulation weaker done what we could actually do is we could plug in another for subject and so what I'm going to plug in is what's called a unary force and so the unary force is basically um I guess you could think of it as gravity that's basically you you plug in a point or a collection of points and you give it a force vector and it'll push that point in that direction so let's see what I mean by that we're going to deconstruct this mesh and then we're going to plug all odd vertices into the points over here and then we're going to plug as eve Ector into our force and so at the moment that Z vector is pointing up gravity is not point up so I'm going to change this slider around a bit so I'm going to give it a maximum value of 10 and I'm going to make it negative and you know I'll make my minimum value negative 10 all right and then I'm going to set this all the way up to maximum value of 10 and I'm gonna plug my unary force into my four subjects as well as the springs and the UM the kangaroo solve is going to break immediately that's because it's register to change and we haven't reset the simulation and this is not a huge issue we just reset the simulation and okay this is another thing I need to point out um a lot of the time if you yeah there's this interesting sort of issue that happens where a kangaroo doesn't know what to do when you've got sort of multiple data structures plugged into these compar these inputs here so you can see we've got two trees of data coming in here in our four subjects list so all we need to do is just flatten this and then really reset simulation kangaroos happy again all right for the purposes of this simulation actually I might really ramp up the UM the numbers here just that we can see what's going to happen so I'm going to preview my mesh on and I'm going to reset my simulation and let's start adding some gravity and so there you go we can see that when now we're now getting a lot more tension than subject and you can see it's it's almost as if it's got a bit of weight to it now it's really being pulled down in the in the z-axis and then we could quite simply just edit this slider and instead we could push it all the way up and we could push it all the way back down and neat little trick that I learned while back actually I can show you now is um okay what we could do is we could throw in another timer over here and we could use a counter and I'm just going to plug this timer into this counter over here oops I only want one time so let me just grab a new one I'm going to keep it at one second and we'll see if it's counting it probably won't be because I need a button okay so it's going to start counting and what we're going to do is we are going to uh we're gonna go we're going to grab an expression and we're going to say it's sent two and so this is always going to give us either 0 or 1 and so then we could multiply this result over here by this here and we could create a really neat sort of dynamic simulation where I'm every time the force direction changes we're getting this sort of an update in our model in simulation cool all right so this has been a really really brief sort of intro into kangaroo we're definitely going to take a look at this plug-in a lot more of the next few lessons so uh hope you enjoyed it and had fun with it
Info
Channel: Daniel Christev
Views: 78,128
Rating: 4.984283 out of 5
Keywords: grasshopper, tutorial, kangaroo, springs, unary force, gravity, dynamic, simulation, yt:quality=high
Id: zeRe57uoEJQ
Channel Id: undefined
Length: 16min 24sec (984 seconds)
Published: Fri Mar 04 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.