How To Play Your Own Games In Blender (Really)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
but yeah and we can uh go ahead and drive our car now like what's going on why am I playing a car game inside of blender oh my God Jesus Christ what's happening the camera needs some work oh my God I hit the light by the way what about cycle hell yeah hi guys my name is boredante and welcome to rigid body World in blender this is coming out of nowhere but last week I was helping NADA with her new project and I decided to just give it a try I suddenly stumbled upon some cool features I never noticed before in physics simulations so in here we have this rigid body and we have rigid body constrained and this thing is freaking awesome this is the kind of rig for this car that I made all these separate pieces are separate rigid bodies including even that connector there so pretty much it's like a Lego assembly process only instead of just connecting things one into another you sort of Define their relation a little bit relationship so let me real quick show you guys how it's done so yeah in here you can see how this is an actual engine in that makes the Wiggles spin this is one thing that I'm still slightly not sure about how exactly it works but seems like I made it work so we're good to go so if I would make like another car what I would start with is a suspension that thing that holds all four wheels together like this stuff that's what I call suspension I may be wrong I I don't care about cars and football but let's say this is what it would look like [Music] and I'll right away extrude just these uh sticks that go to the actual wheels so this kind of thing unless let's make the scar a bit smaller so it would be cute and I'll apply a scale and everything else I kind of don't care about now let's add wheels and then we'll add like the the main body of the car here's the thing I know English only in areas where I'm interested in the media about a subject so cars I've never watched English shows about cars so I have no idea how things are called because whatever I'm learning I have to have fun so yeah I don't know boring stuff so I'll just put the wheel like this on the ground also I like turning on this thing like object gizmos and just use like move to see where the accesses are oriented I'm kind of hating this maybe I just rotate the actual polygons right that way everything else will stay the same and yeah all of of this like right now I'm like attaching a wheel to the suspension all of this is just for the looks and for another extra thing which is um just collisions you know if you would make a car that has its Wheels like floating at a big distance it could at some point you know hang on its whale with all this negative space in between so you don't want that you want it to be like a solid object that doesn't have like weird holes or something like that so yeah about this whole thing honestly I'm making this video I have no idea if blender Community is generally aware a lot about the awesome potential of rigid bodies especially with like rigid body constraint it's like this huge thing all right so this surface is tilted a little bit let's raise the whole thing in the air because it's best to like you know like in a game when something spawns it's kind of like lands from a little distance that's because you don't want anything to overlap yeah so let's add the body of the car and for now I'll just keep it like a cube which is pretty much the same thing I did here so just to make things clear I'll keep it like this at a distance for now so now what we do is like if you're generally familiar with how blender Works usually if you want one object to move with another object you make the main object like a parent to other objects right so you just would have like two objects and one would be like you hit Ctrl p and make that apparent and now when I move it or rotate it it will be like a child to it while this one can do whatever it's been once this one controls the child in the rigid body world you actually can't use that at all to parent something you need to use a rigid body constraint so we'll start with attaching well Wheels to the suspension let's do that so first of all we need to make all of these objects rigid bodies and right now I hit Alt Enter and it didn't do the thing I was expecting it to do anyway we can do it this way we may get like rigid body add active so now all of them are rigid bodies and since I'm using simple shapes you we can actually use like Collision shapes specifically for like these primitive objects oh God damn it whatever I don't care let's make it an actual mesh why not if you use one of these it will be much more optimized whatever that means maybe maybe not if you're actually using a cylinder won't it work if you use the actual mesh it will work just like a cylinder and that's it okay so the cube worked as a cube you can see now we have this black lines that's actually not just the wireframe it's the Collision shape and yeah suspension is a complex shape so let's do mesh as well but yeah that whole thing is not that important if you would just leave it at convex hall for everything it would probably work more or less fine but may have some glitches Twitches anyway now what we do do is is we add to each wheel the rigid body constraint and we Define the first object of that constraint is the wheel itself and the second one would be a suspension which is called Cube let's call it correctly and so will one is connected to suspension using fixed rigid body constraint and fixed means just dead attached to it like a glued or something so right now oh crap I really should have saved yeah another thing about rigid body world when you when you're working with that things crash a lot and I don't think it's like you know in this version of blender I don't think they've ever touched rigid body World in many many versions like since 2.8 it's probably is like any other version between 3.4 and 2.8 would be as crashy as this one I feel like it haven't tested that but yeah oh yeah so yeah you can see this is glued to the thing if we ignore other stuff and other stuff explodes actually because when you create a rigid body constraint there's this automatic checkbox that is applied in here that's called disable Collision so between these two objects it doesn't Collide it doesn't try to make them not overlap so right now they all literally overlap we can see how it goes inside right and this overlapping is right now not a problem so it won't try to simulate a collision but with all of these it still does because they don't have rigid body constraints so that's why they shoot out so yeah I'll just go ahead and go through all of these and attach the current wheel to the suspension current wheel suspension so yeah is that easy it has no geometry nose or anything like that this is like super old school stuff that was available in blunder since forever probably so yeah now if I play this whole thing acts like one solid piece but we don't want that we want them not to be perfectly attached we want them attached but spinning still in this one axis around x-axis we want the wheels to be able to spin so we'll go to generic control I think that's the best way to do it in our situation so in here I will Define limits first of all linear I don't want it to go anywhere so I'm defining limits are like zero any movement in any axis so we're perfectly fixating this wheel in place which we will evolve later of course but that's what we do at first and then Y and Z angles are also zero so no wiggling like that or like that as well and this one won't have any limitations at all because the wheel can spin forever so let's do the same thing for everything else and finally the last wheel so right now we can see things are connected but these wheels actually let the car go forward there's no engine or anything but it can just roll forward and yeah another thing it doesn't touch the ground at all which looks pretty bad so what we can do is we can go to rigid body settings and bring that margin of collision to zero and like Alt Enter that I hope yeah that will apply it to all objects and now yeah it's perfectly in contact with the surface looking more realistic now let's real quick set up this thing so we would start with um again rigid body constraint and I would make it well fixed at first and now it would be all right fixed to what right so you to the suspension and yeah by the way one thing that I always felt weird about when I was trying to figure it out like why do I have to Define two objects cannot be any kind of two objects actually yes thing is you can create as many constraints like these rigid body constraints and the scene as you want about any objects but you can see how we can only make it once per object so we can create one like just we can place it write it down Define set up in one object only once so what you do is you create like empties and all kinds of stuff that will have other kinds of rigid body constraints you can see this is an empty so it doesn't have many things at all for physics but it has rigid body constraints it can't even be a rigid body but it can Define connections between two different rigid bodies so that's how you can Define all kinds of things you need but yeah for now we have the super hard car that would completely destroy your ass if you will try to ride this now let's see how we can make things a bit softer and bounce around in a realistic way which is the best part because so far it was almost just like having parented objects except we're capable of making the wheels actually spin in physics so that's already cool but here we can switch to instead of fixed we can switch to generic spring and it's the same as generic like we can Define what's fixed and what's not in limits in angles and linear is like position position and rotation so in this case I would like lock actually I won't be locking angles at all I will lock position but not in the z-axis maybe at all I'll turn it off so we just locked X and Y so it wouldn't go away in these directions and now if we go lower in here we have Springs and in here same accesses for angular and linear so in this case we did not lock z-axis right now if I hit play a it will just fall completely down and it won't even collide with the suspension now because disabled collisions between the two connected rigid bodies so now since it's completely free we need to add the the spring and the spring is like the soft bouncy limit it's trying to stay in this one place related to the suspension but it has this certain stiffness and damping so if I just hit play well it was kind of softer fall but not not very useful what if we go 100. ah now what's more interesting also we're spinning around a lot so in that case uh what are the angles that we should not be spinning in pretty much all of them so I'll just turn on all these default settings for Springs in all three dimensions for the angle and now it will like Bounce Around uh in different directions but always try to stay facing forward like this and yeah it is bouncing around a lot and won't calm down at all so we can increase that stiffness to 500 and we can increase or decrease damping damping is how much of it like stiffness is how much of an amplitude it'll it allows to bounce around given certain weight and distance of the fall and all that but damping is how much it will be just doing these tiny Wiggles until it comes down so in this way we'll have a lot of quick bounces that come down very slowly and if I increase stiffness even more they will be even tinier and faster bounces but they will still be coming down for the same long time so if we keep this at 500 but this damping will become like 10. that's a lot more stable looking but you can see the tilting now is kind of obvious so this should be kind of stronger as well let's make these like a hundred and I know five of damping should look fine yeah I like that so that's for the for the body of the car but the wheels should also have these spring kind of things as far as I know at least that's the way I did it maybe only SUVs have that but I did it everywhere we just need to define the proper rigid body constraint in this case we replace generic with generic spring and when you do that all the settings from the limitations are kept in place but we need to remove the z-axis for linear limit because if it's completely at zero and it's held in place with no movement the spring won't do anything the spring needs free movement so it would constrain it so now we turn this on and make it 510 so yeah I'll just set up all the wheels to do the same thing okay now we're seeing it and what's interesting of course we're not seeing the bounce in the wheels we're seeing the bounce in the suspension because the wheels are holding the suspension and now it's bouncing around and it's a cool thing because if we just have some kind of a rigid body obstacle like this and you just set it up to passive that's how you create a floor you just put a big polygon and you define it as rigid body passive so it wouldn't fall with gravity or something but be a collider but yeah right here at this stronger angle that's where we can see the benefit of this individual Springs per each wheel it actually got raised and uh the car can continue driving to its imminent death so in order to make the wheels actually ride forward not just with gravity at a little inclination here but actually drive forward the way my reference card does that so we need to create this kind of object and by the way there's another example right here you can see two cubes and one of them is being driven by this motor Cube that has this constant rotation going on and that's what it does to this random Cube as far as I understand it doesn't actually translate the exact axis of rotation to that same axis of rotation on this other Cube it can adjust if it's spinning in this direction in the world that's where the cube will try to go no matter how it's rotated as far as I understand I'm still not quite certain because there's not a lot of settings on how accesses of objects relate so I assume it's not about that at all it's just the way it does it and here it will be pushing that other object the same way and that's it so anyway let's turn let's duplicate this obstacle here and it will become a motor and I'll do that by adding to the X rotation axis right here I'll add like a like a driver and I'll just put frame multiplied by point zero or 0.1 so what I just wrote in there is that uh the number defining the angle in the x-axis will be simply the number of the frame so at frame one we'll have one but multiplied by 0.1 which is 0.1 0.1 but it's in radians so it results in 5.73 degrees and all of that means is that simply as time goes forward as frames go forward the angle will be changing on the object and so it's just an infinite spin really cool thing so yeah let's see how we can add the influence of our motor here to the wheels so for that like we have one motor and we need to create four different rigid body constraints to each wheel and each wheel already is connected to the suspension with its rigid body constraints so we need a new object to Define another rigid body constraint so now we create let's say an empty and it will look like a circle because a wheel you can put them kind of like this four wheels and four connections so what we'll do here is We'll add let's try selecting all of them and I'll hit Alt Enter on Rigid body constraint well that's select nope it won't so yeah we'll have to do it for each one individually but yeah the first object will be the corresponding wheel on each and one of these guys and then the second will be just the engine so that's actually all of it that's oh right it shouldn't be fixed so we need to switch to motor on all of them and yeah we're transferring the angular force from this motor motor Cube to the wheels are we gonna do it I'm not sure like the engine is spinning pretty slowly let's make impulse like 10 on all of them whoa whoa whoa whoa whoa yeah um here's the thing so the spin is around x-axis and for whatever reason it would try to spin in a different direction obviously that's just spinning there why I'm not sure how it whole thing works because this thing is spinning around the x-axis and these guys should be spinning around the x-axis but for some reason it's like not exactly working that way oh yeah so one more thing I like doing I would add like a little detail to the wheel so we would be able to see the rotation oh there we go and now we'll be able to actually after this quick crash we'll actually be able to see how the wheels actually rotate and yeah so the wheels just absolutely want to spin like this like like this but not like this in the world and I'm not sure why okay like two hours later and after watching this really awesome tutorial from AKA Studios and it's all about this exact approach so pretty cool stuff make sure to check it out for the real tutorial but here I am finally making things work so about the steering wheel what's interesting like when you make your wheel turn all of these like z-axis goes all over the place because when the wheel goes forward the z-axis is here now or whatever so we can't rely on the coordinate system of this wheel so that's why we duplicate it and make another wheel that's just about turning the main wheel turning meaning like steering so this one is all about that and when it's turning this wheel is turning with it while on its own it's turning around its own x-axis now about the engine forget about the stupid thing about spinning cubes that I had on both cars now I don't have that you don't need anything to be spinning at all so what you do is as you guys can see I have a bunch of empties in here now and all the empties are just facing up with their Z's except for these two because as AKA Studios explained in their tutorial motor gives you acceleration in x axis and that's it no like it doesn't need to be for from some kind of spinning object in a certain direction no one cares about that it's about the object where the rigid body constraint is written down in this case that's why I'm using empties now a lot instead of writing down stuff in the wheels themselves they don't have constraints anymore because you need to define specific accesses to define the orientation of your rigid body constraints so in this case I rotate around the x-axis and I'm giving this mini steering wheel the acceleration of 0.2 at like strong impulse meaning it can really work through some friction and resistance a strong turn but a little bit to the right or to the left like zero means just forward and negative is turning One Direction positive turning the other direction and that's it that's how angular speed works it's about like angle different from zero just one way or another and yeah it's very purple because I pasted a driver that is just rotation of this Taurus right here so when I turn it the wheels turn they have this slow kind of like lag of turning I wonder if I can make that impulse a lot stronger will that help so we have that and also I added to this Taurus right here a custom property usually it's a thing at the bottom but you can like drag it up your custom properties and you just add a new custom property I called it speed and it's attached to the motor constraints and their velocities and they also have x-axis facing this direction and they are parented to the suspension and everything is a connection of the wheels to the suspension or to something that's where the car is so the coordinate system would be at the right place I guess it matters and generally these empties are parented to the suspension and all of them are parented so if I just add some speed rate here you can see all the empties are traveling with the car which makes a lot more sense but yeah and we can uh go ahead and drive our car now slowly and carefully oh my God this is so creepy like what's going on why am I playing a car game inside of blender now this is all fun and all but can I like attach a camera toy like I I have to be able to write we have a camera right here okay so I'll parent you to Here and Now oh my God Jesus Christ what's happening uh huh this is so trippy let's see if I can destroy this giant truck uh lesser non-game Graphics Also let's make our car blue and everything else is this dark color like this material also I have some class let's add some bevel now the controls let's say like strong yellow and they may like glow too all right let's go oh it's lagging oh my God it was happening whoa this is so Dynamic damn oh I I I failed okay one more time oh my God the spinning is nuts I think that because like I have a shifting uh axis of rotation oh no it's following me the the truck boom oh my God this is so hardcore doorbell is bad the camera needs some work oh my God I hit the light ah wow so yeah it's kind of lagging because EV traders in Full Resolution full screen they are actually intense especially if you set things up very heavily which I of course did this is Cycles Anyway by the way what about cycle hell yeah looming my ass this is what I need oh my God whoa what an intense battle this cube is alive too whoa whoa whoa whoa whoa whoa whoa okay I I need to get good so I'll take care of that in the meantime but for now this is it thank you guys for watching let me know what you think if you have some advice thoughts if you if you find it useful at all I think this is really cool that you can do stuff like that and of course like this is like a full-blown gameplay here we're having but you can see how you can really enrich your animation no matter what you do because you can add like realistic Wiggles and uh shakes to mechanisms and different stuff just like that and then bake it like bake any animation into keyframes and you will have that realistic movement of whatever complex structures and everything but for me this is it thank you guys for watching and I'll see you all in the next video bye get get it you scum it's hard to play when you can only change your speed very slowly there we go I think I won because I just stopped and that truck just fell off the world yay
Info
Channel: BoroCG
Views: 28,614
Rating: undefined out of 5
Keywords: blender, rigid body, constraint, gaming, game, physics, car, simulation
Id: iVkpGE58axQ
Channel Id: undefined
Length: 28min 43sec (1723 seconds)
Published: Mon Feb 13 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.