Skip to content

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.

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.

  1. 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.

  2. 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_FloatWoodDinghyBoat has three Wood spheres of radius 30 cm at X = 100, -20 and -140 cm; BP_FloatRunaBoat has 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.
  3. 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).

  4. 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_FloatCube is a Marine Steel box with 50 cm extents around an Air box with 48 cm extents: a 2 cm steel shell that floats.

  5. 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).

  6. Play and check with the debug view (below). Adjust sizes, positions and the offset until the waterline sits where the mesh shows it should.

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.
ShapeBest forNotes
BoxFlat bottoms, square sections, pontoons, hollow shellsResists fast spinning the most. Works well for Air carving when unrotated.
SphereRound sections, buoys, the “three along the keel” layoutNo extra resistance to fast spinning. Works well for Air carving.
CapsuleLogs, round hulls, canoesRuns 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.

The debug view shows the shapes and the forces on them. Open the console during Play and run:

drw.debug.preset buoyancy
drw.debug.cat shapes 1
drw.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.

SymptomLikely causeFix
Sits far too low or sinksSolid metal shapes, or too little volumeHollow 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 angleThe object is rotated in the level, so its Air box removes too much massPlace it with zero rotation, or turned in steps of 90 degrees.
Sits far too high or bounces outToo much volume, overlapping solid shapes counted twice, or Air carving too muchShrink or separate the shapes; check Air shapes are boxes or spheres with zero rotation, fully inside a solid shape.
Lists to one side at restShapes not mirrored across the centerline, or the center of mass is off-centerMirror the shapes in pairs; check Center Of Mass Offset Y.
Capsizes easilyCenter of mass too highLower it with a negative Center Of Mass Offset Z.
Ignores the slope of waves, only bobsWater Sample Count is 1 on the main shapesSet it to 8 on the shapes that carry the hull.
Jolts sideways in choppy waterShort, choppy wavesRaise Water Sample Smoothing on those shapes.
Shapes added to a skeletal mesh disappearThe mesh has a Physics Asset, so DRW builds the shapes from itEdit the Physics Asset instead, or use a Static Mesh target.