Habrador / Unity-Boat-physics-Tutorial

Learn how to implement boat physics in Unity
https://www.habrador.com/tutorials/unity-boat-tutorial/
MIT License
98 stars 36 forks source link

Quick question about drag caused by slamming #1

Open victornor opened 1 year ago

victornor commented 1 year ago

Hey Erik, Firstly, thanks for making this, it's much appreciated.

I'm making a boating game and i have used this code to make floating more dynamic. I'm experiencing some issues trying to get realistic water drag because the slamming causes velocity to drop quickly, even with 0 drag.

Here's a video of my issue https://vimeo.com/774041994 First 25 seconds is using total mass = 1000 and slamming cheat = 3. Then i turn down slamming to 1, which lets my boat glide with low drag, but this makes the boat very unstable causing rolling.

Any tips would be greatly appreciated. I already reduced all forces by 100x, allowing me to reduce the rigidbody mass to 1.

stackh34p commented 1 year ago

I've had the same issue. Besides it killed off the vessel speed gradually, it caused an exaggerated counter force that made the vessel rise above water level. The vessel has a rigidbody and is moved by adding a force at the sail direction.

The way I got around it was to keep the slamming force only on the Y axis, which no longer added the counter force.