Approximating a hull with physics shapes
A DRW object floats on its DRW Physics Body shapes, never on its mesh. How well those shapes match the underwater part of a hull decides where the boat sits in the water, how it rocks and pitches, and how it rides waves. This page is the practical workflow. The settings themselves are described in Making objects float.
What the shapes do
Section titled “What the shapes do”Each solid shape lifts the hull where its submerged part is. So:
- Where a shape is decides where it lifts. Shapes spread along the hull let waves pitch the boat and resist pitching; shapes spread across it do the same for rolling. A sphere’s lift always passes through its center, so a boat floating on spheres in a single line relies on a low center of mass to stay upright.
- How big a shape is decides how much it lifts. The boat settles where its submerged shapes hold up its whole weight.
- The shape’s material decides its weight. The boat’s mass is the total of its solid shapes, minus what Air shapes carve out. DRW sets it on the mesh at Begin Play.
The mesh’s collision is not used for buoyancy. Keep it for contacts with docks, rocks and other boats.
Workflow
Section titled “Workflow”-
Decide the weight. Pick a real-world weight for the object. The heavier it is, the more shape volume has to be under water to hold it up, so the lower it sits. Lighter water (a lower Water Density) lets it sink deeper too.
-
Rough out the underwater volume. Cover the part of the hull that sits in the water, plus a little above the waterline so it has reserve buoyancy in waves. Start with few shapes:
- A small boat or long float: three spheres along the keel line. This is what the shipped floating hulls use:
BP_FloatWoodDinghyBoathas three Wood spheres of radius 30 cm at X = 100, -20 and -140 cm;BP_FloatRunaBoathas three Wood spheres of radius 60 cm at X = 240, -20 and -240 cm. - A flat-bottomed hull or barge: one or two boxes, or a box per section.
- A long round hull, log or canoe: a capsule rotated to lie along the hull, or a row of spheres.
- A wide hull that should resist rolling: place shapes in left and right pairs, mirrored across the centerline.
- A small boat or long float: three spheres along the keel line. This is what the shipped floating hulls use:
-
Pick materials. Use the real material where the hull is solid enough to treat as a block (Wood, Treated Wood, High-Density Foam). For metal or fiberglass hulls, which would sink as solid blocks, make the shape hollow (next step).
-
Hollow out heavy hulls with Air. Put an Air box inside a solid box, or an Air sphere inside a solid sphere. The Air shape removes the solid’s mass where they overlap; the outer shape still displaces water.
BP_FloatCubeis a Marine Steel box with 50 cm extents around an Air box with 48 cm extents: a 2 cm steel shell that floats. -
Set the center of mass. Lower it with Center Of Mass Offset (cm, negative Z) until the boat sits upright and recovers from a tilt. The shipped floating hulls use -80 cm (dinghy) and -300 cm (runabout hull). Turn on Use Custom Center Of Mass if you want DRW to shift it by the mass-weighted position of the shapes instead (see Mass and center of mass).
-
Play and check with the debug view (below). Adjust sizes, positions and the offset until the waterline sits where the mesh shows it should.
How many shapes
Section titled “How many shapes”More shapes spread the forces more evenly and follow the hull’s shape more closely, but each one costs CPU. Shapes with a higher Water Sample Count (default 8) also use more of the level’s water sample budget (drw.WaterQuery.MaxQueries, 4096 by default); Air shapes and shapes set to 1 use the least.
Practical guidance:
- Start with the fewest shapes that cover the hull: often three to five for a boat.
- Keep Water Sample Count at 8 on the shapes that carry the hull, so the boat feels the slope of the waves. Use 1 on small parts that only add weight or volume.
- Add a shape when the boat clearly misbehaves in one place (the bow dives, one side sits too low), not before.
Rules that keep a hull correct
Section titled “Rules that keep a hull correct”Choosing between shapes
Section titled “Choosing between shapes”| Shape | Best for | Notes |
|---|---|---|
| Box | Flat bottoms, square sections, pontoons, hollow shells | Resists fast spinning the most. Works well for Air carving when unrotated. |
| Sphere | Round sections, buoys, the “three along the keel” layout | No extra resistance to fast spinning. Works well for Air carving. |
| Capsule | Logs, round hulls, canoes | Runs along its local Z axis; rotate it 90 degrees to lie along a hull. Avoid using capsules in hollow (Air) setups. |
A capsule’s Half Height includes its rounded ends, as in Unreal’s own capsule.
Checking with the debug view
Section titled “Checking with the debug view”The debug view shows the shapes and the forces on them. Open the console during Play and run:
drw.debug.preset buoyancydrw.debug.cat shapes 1drw.debug.focus BP_MyBoat- Shapes draw as outlines in their material’s debug color (Air is light blue, Wood brown, Marine Steel steel blue). Check that they cover the hull and nothing sticks out where it should not.
- Buoyancy arrows (cyan) start where each shape is lifted. At rest on calm water they should be roughly mirror images left to right.
- Gravity (red) arrows show the weight of each shape. The readout’s Gravity total is the whole object’s weight.
- The on-screen readout lists In water, Shapes (how many shapes are reading the water), the force totals and the Net force with a trend: steady, rising or sinking. A boat at rest should read steady.
You can also call Debug Draw Shapes on the DRW Physics Body from Blueprint (every frame, for example on Tick) to draw just that body’s shapes. The full list of debug commands is in Debugging and setup checks.
Common problems
Section titled “Common problems”| Symptom | Likely cause | Fix |
|---|---|---|
| Sits far too low or sinks | Solid metal shapes, or too little volume | Hollow the shapes with Air, use lighter materials, or enlarge the shapes. |
| A hollow object floats far too high or jumps out of the water only when placed at an angle | The object is rotated in the level, so its Air box removes too much mass | Place it with zero rotation, or turned in steps of 90 degrees. |
| Sits far too high or bounces out | Too much volume, overlapping solid shapes counted twice, or Air carving too much | Shrink or separate the shapes; check Air shapes are boxes or spheres with zero rotation, fully inside a solid shape. |
| Lists to one side at rest | Shapes not mirrored across the centerline, or the center of mass is off-center | Mirror the shapes in pairs; check Center Of Mass Offset Y. |
| Capsizes easily | Center of mass too high | Lower it with a negative Center Of Mass Offset Z. |
| Ignores the slope of waves, only bobs | Water Sample Count is 1 on the main shapes | Set it to 8 on the shapes that carry the hull. |
| Jolts sideways in choppy water | Short, choppy waves | Raise Water Sample Smoothing on those shapes. |
| Shapes added to a skeletal mesh disappear | The mesh has a Physics Asset, so DRW builds the shapes from it | Edit the Physics Asset instead, or use a Static Mesh target. |