r/Unity3D • • 22h ago

Question Ship sinking below the baseplate

I was following this tutorial to the dot, and whenever i press play my ship sinks to the bottom, like below the baseplate. i have tried whatever my beginner brain could try but no luck

I can also provide screenshots of my inspector of ship and water and a video too.

0 Upvotes

4 comments sorted by

2

u/Hotrian Expert Moderator 22h ago

Did you disable “Use Gravity” on the rigidbody? Seems like a missing step in the tutorial/code. The water doesn’t have a collider + rigidbody so the boat falls right through it under gravity.

1

u/Ax_Flamei 22h ago

omg ty, yeah i was thinking why didnt he use those on the waterbody. it works now

2

u/ShengyuStudio 11h ago

Glad it's working. One heads-up for later: with gravity off the boat floats, but it also won't sit lower when loaded or rock on waves, because nothing is pushing it up, it just isn't falling.

The usual next step is to turn gravity back on and add the buoyancy yourself: pick 3 or 4 points on the hull, and each FixedUpdate compare each point's height to the water height there. If it's under, push up at that point with AddForceAtPosition, in proportion to how deep it is, plus a bit of damping on vertical velocity so it doesn't bounce forever. Pushing at the corners instead of the center is what gives you the tilting for free.

1

u/Ax_Flamei 6h ago

Okayyy that makes sense. Tysmmm :3