https://github.com/zaurondark/unity-simple-water-buoyancy
This is a very simple Water Buoyancy C# Script for Unity3D Game Engine, No additional forces or Drag or Wave applied with this Script just simple Up force.
https://github.com/zaurondark/unity-simple-water-buoyancy
buoyancy c-sharp component csharp script unity unity3d
Last synced: about 1 year ago
JSON representation
This is a very simple Water Buoyancy C# Script for Unity3D Game Engine, No additional forces or Drag or Wave applied with this Script just simple Up force.
- Host: GitHub
- URL: https://github.com/zaurondark/unity-simple-water-buoyancy
- Owner: ZauronDark
- Created: 2019-09-12T04:54:14.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-02-22T16:54:07.000Z (over 6 years ago)
- Last Synced: 2025-03-17T05:34:23.298Z (about 1 year ago)
- Topics: buoyancy, c-sharp, component, csharp, script, unity, unity3d
- Language: C#
- Homepage:
- Size: 5.86 KB
- Stars: 16
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Unity-Simple-Water-Buoyancy
This is a very simple Water Buoyancy C# Script for Unity3D Game Engine,
## How to setup
-Add box Collider on Water Body and set it as Trigger.
-Also Add "WaterBody" component On it (optionally you can change surface level property if needed)
-Give water object Tag as "Water" (or you can change "waterVolumeTag" property accordingly)
-Add "Buoyancy" component on a Rigidbody Object that you want to float on WaterBody.
## What this Dose
-Rigidbody with "Buoyency" Component floats on "Water" Tagged body.
-Check if Rigidbody is inside X - Z bound of Water body and gives force on Y Upwards.
-Buoyant force (Upwards force) increases as rigibody dive deep underwater. (can be variable by depthPowerLimit property)
## Limitations
-This is clearly NOT real world Physics, just simple Up force.
-No additional forces or drag or waves.
-As this component is limited to Y axis buoyancy, make sure your Y is up, however feel free to modify.
-Other collider types will work as long as water surface level stay flat, as this is designed on checking collider bounding box.
-Rigidbody never fall Asleep if inside water body.
-Don't stack water Bodies on top or duplicate on same location.
