Posted May 23, 2025 by SourlessCream
New Features
Automatic Water Surface Detection on Start:
If targetSurface is not manually assigned, the script now searches for the first WaterSurface component in the scene during Start().
Automatically enables buoyancy when a valid water surface is found.
Water Resistance (Drag) Simulation:
Added ApplyWaterResistance() method, which applies a drag force proportional to the object's velocity while in water.
New public variable waterDrag added to control drag strength.
Modified Start() to include automatic WaterSurface detection logic.
Added ApplyWaterResistance() to FixedUpdate() to simulate underwater drag.
Introduced waterDrag float for easy tuning of resistance force.
Ensured velocity damping uses ForceMode.VelocityChange for consistent results.
New Inspector Field: waterDrag (default: 1.5) — adjusts water resistance intensity.