Added Water Drag and Resistance
New Features
-
Automatic Water Surface Detection on Start:
-
If
targetSurface
is not manually assigned, the script now searches for the firstWaterSurface
component in the scene duringStart()
. -
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.
-
Code Changes
-
Modified
Start()
to include automaticWaterSurface
detection logic. -
Added
ApplyWaterResistance()
toFixedUpdate()
to simulate underwater drag. -
Introduced
waterDrag
float for easy tuning of resistance force. -
Ensured velocity damping uses
ForceMode.VelocityChange
for consistent results.
Configuration
-
New Inspector Field:
waterDrag
(default:1.5
) — adjusts water resistance intensity.
Files
Get Buoyancy Water Physics | HDRP Unity 6.000
Buoyancy Water Physics | HDRP Unity 6.000
Water Buoyancy made Easy
Status | Released |
Category | Assets |
Author | SourlessCream |
Tags | Physics, Unity |
More posts
- Currents/Wind InteractionJan 18, 2025
Leave a comment
Log in with itch.io to leave a comment.