A downloadable asset pack

Buy Now$2.99 USD or more

Buoyancy Script for Unity

Bring Your Objects to Life with Realistic Floating Physics!

Create stunning water interactions with this easy-to-use buoyancy script! Perfect for boats, barrels, debris, or anything you want to float and interact with water dynamically. Whether you're building a serene ocean scene or a stormy adventure, this script gives your objects realistic buoyancy with customizable behavior. 🌊

Features

✅ Dynamic Buoyancy: Objects float and respond naturally to water movement.

 âœ… Wave Conformance: Adjusts to water surfaces using Unity's HDRP WaterSurface system. 

 âœ… Customizable Settings: Fine-tune buoyancy strength, damping, and sinking depth. 

 âœ… Easy Setup: Simple to integrate and works with tagged water objects. 

 âœ… Versatile: Works for a wide variety of floating objects, from tiny debris to large ships.

How to Use

Step 1: Attach the Script

  • Drag the Buoyancy script onto any GameObject in Unity.
  • Ensure the GameObject has a Rigidbody component. If not, add one via Component > Physics > Rigidbody.

Step 2: Configure the Rigidbody

  • Enable Use Gravity in the Rigidbody settings.
  • Adjust Mass and Drag values to fit your object's size and behavior.

Step 3: Assign the Water Surface

  • Use Unity's HDRP WaterSurface or any collider tagged as "Water."
  • Drag your water object into the script’s Target Surface field in the Inspector.

Step 4: Fine-Tune Settings

  • Factor: Controls buoyancy force strength.
  • Damper: Smooths out movement to reduce jittering.
  • Sinking: Determines how much the object submerges into the water.

Step 5: Test Your Scene

  • Place your object above the water in the scene.
  • Press Play and watch it float!
  • Adjust settings as needed to achieve the perfect floating effect.

Important: Enable Water Projection

Enable Use Water Projection to make objects conform dynamically to waves and surface normals. This is perfect for creating immersive, wave-driven interactions!  It is required for the buoyancy system to work.

Why You'll Love It

This script is designed for developers who want robust, physics-based water interactions without the hassle. It’s highly customizable, lightweight, and integrates seamlessly into your Unity projects.

Published 5 hours ago
StatusReleased
CategoryAssets
AuthorSourlessCream
TagsPhysics, Unity

Purchase

Buy Now$2.99 USD or more

In order to download this asset pack you must purchase it at or above the minimum price of $2.99 USD. You will get access to the following files:

Unity-HDRP-WaterBuoyancy.unitypackage 6.5 kB

Leave a comment

Log in with itch.io to leave a comment.