Unreal Engine Buoyancy - Making a Boat Float in UE 5.3

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone so as a followup to my last video let's take a look at unreal engine's buoyancy component just as before make sure you have a landscape and a water body and that the Collision of the water body is set to water body collision that's right here so first let's click on our all folder in the content browser and search for buoyancy epic games has given us an example Cube so let's uh let's just make sure that works first so if we press play it should be floating and there we go looks good you can also open it up and see what's inside for reference there's our buoyancy component you can see there's what they call pontoons and there's four points one in each quarter those are basically float points but for now let's go back to our content folder now that we know the system works let's create an actor I'll call it BP boo so let's open that up and add a static mesh component then make it the parent component by dragging it over default scene route and then over here we can select the mesh we want to use I have this boat mesh so I'll just be using that epic games does provide a little example boat mesh to follow along if you don't have one so right down here you can download the mesh with this guide if you want to follow exactly as shown I'll leave a link for that page in the description now let's add the buoyancy component as we saw in the buoyancy example we'll need to add at least four pontoons which are basically isolated float points to keep it stable and upright so what I do just to visualize where they're needed I add a scene component and just move it around uh cuz then see you can it'll tell you exactly where it has to go so the first one is 200 y so let's go in the component our first one here 200 Y and I'll just follow this same pattern for the rest of them I'll add one here here here and here so I'll just put those in and now that they're all placed let's take a look at how it performs but first let's not forget to click simulate physics on the mesh so we have our water let's drag it out keep it a little bit above the water and play okay so as you saw it sank right down there so now we have to adjust the buoyancy Force applied to the boat with the buoyancy coefficient variable in the component so that's down here let's try 0.5 okay 0.5 seems about right for this Mass but it's flipping over almost immediately so now I'll demonstrate this debug command so that's r.w water. debug buyy one so you see the Pontoon radiuses extend way too far under the boat so let's reduce their radius and move them up into the center of the boat so first of all the The Zed value here let's make it around 40 for each one so let's add our scene back real quick that'll be about here and the radius I'll make it about 50 I'll make it 50 for each and that affected the buoyancy so let's go back I think four worked okay so yeah about four when they're 50 and then I should be able to jump on it and it doesn't sink or anything okay you see how let's try that again so it's kind of ridiculously bouncy right so let's go into the component once more and take this flag apply drag forces in water and the default values here should be fine and now it's much more stable in the water uh keep in mind too the static mesh has its own settings in the physics category um the linear and angular damping that will give it drag uh while it's moving so you could try to experiment with that but for now I'm just going to stick with the uh drag forces in the water so that's mostly it also be sure to check other settings so just for an example apply River forces so let's add a river and you'll see one thing here you'll see a few things so it moves with the river right moves with the water flow notice how it's pushed to the shore if you don't want this to happen just set watershore push factor to either zero or a negative value to keep it in its place or to push it towards the center of the river so I'll demonstrate that here I'll start with zero and by pressing f8 I can see the actual spline of the river and you notice how it's just kind of following along if I move it it'll stay in its position you know relative to the spline however if we go back and set this to a negative value it'll try to Center uh the pon tune with index zero so that's this one here by the front it'll align that with the SP spline so you can see it happening so my instinct was that this is how you would change that but setting that has done nothing so the alternative is you can copy index zero here and then set its uh location to all zero and then add a new pontoon while reducing the radius so it doesn't affect uh buoyancy and then in that new one we added we can paste the location to replace uh the one we just deleted so now see this mini one should be the center and now it floats along the center and if we move the boat whoops that sent it flying okay let's restart move it a lot more gently this time so if we move it it'll creep back to the center of the river and the final example that'll give you maybe you don't want the river to put at all so we can set max water Force to zero or anything lower and there you go it stays in place so yeah there you have it hopefully this was helpful there is also a way to use materials to kind of clip out the water from being shown inside the boat yeah I will not cover that right now let me know if you do want to see that or if you want to see how to kind of get in this and control it like a physics based vehicle um but yeah thanks for watching hopefully it was helpful I'll see you in the next one
Info
Channel: Peanut Games
Views: 1,109
Rating: undefined out of 5
Keywords: ue, ue4, ue5, unreal engine 4, unreal engine 5, game development, buoyancy, buoyancy force, water, boat, float, objects float in water, how to, buoyancy component, swim, swimming
Id: T9iaEOkDHck
Channel Id: undefined
Length: 10min 24sec (624 seconds)
Published: Mon Mar 04 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.