Water Volume
This guide will help you integrate the Water Volume feature effectively into your projects using Oceanology. By following these detailed steps, you can ensure realistic interaction with water bodies, enabling actors to swim or float naturally within the defined areas.
Overview to the Water Volume Setup
The Water Volume is crucial for enabling buoyancy within Oceanology. It defines the areas where actors can interact with water by floating or swimming. Properly configuring Water Volumes ensures that buoyancy components, such as the OceanBuoyancyComponent, function as intended, providing realistic water physics for your project. The Water Volume in Oceanology is a volume box that controls physics and allows swimming. You can place multiple water volumes in a scene depending on how many bodies of water you want to create and the size of the area you wish to make buoyant or swimmable.
It is crucial that all objects intended to be buoyant or swimmable have "Generate Overlap Events" enabled, and they must also have at least a basic collision setting that permits overlap events. You can see examples in the demo levels to better understand the requirements.
Add and Configure Water Volume
-
Start by adding a Water Volume to your scene. You can find the
OceanologyWaterVolume
actor within the Oceanology plugin.- This volume will determine the areas of water where actors can swim or float.
-
Set the Oceanology Water Parameter
- The Oceanology Water field is a required parameter for this actor. Without this setting, the water volume will NOT function.
- Select a water body from your scene for this field. This could be the infinite ocean or one of the lakes in your project.
- If you plan to have multiple water bodies, each one requires its own water volume. For instance, if you have 10 lakes and an ocean, you will need at least 11 water volumes to cover them all. Similarly, if you want to manage the shores of the ocean separately, you may need even more volumes.
-
Adjust the Volume Size (Box Extent)
- Use the Box Extent parameter to control the size of the volume. This option allows you to extend the volume along the X, Y, and Z axes to cover the desired area of water.
- Properly configuring the size is essential for defining the areas that should be swimmable or where buoyancy should apply.
-
Initial Overlap Check
- The Initial Overlap Check occurs at BeginPlay (the start of the game), and it includes a small delay.
- This feature ensures that actors are correctly detected as overlapping the water volume at the beginning of the scene. You can disable or adjust this setting, but doing so might prevent some actors from being detected for buoyancy or swimming after BeginPlay.
-
Enable Buoyancy in the Area
- The Enable Buoyancy in Area setting controls whether actors with the OceanBuoyancyComponent can float within the volume.
- Make sure to enable this option for all areas where you want actors to experience buoyancy. This will apply realistic floating behavior to any actor with the buoyancy component.
-
Enable Swimming in the Area
- Use the Enable Swimming in Area option to determine if the volume should be swimmable.
- If this is set to True, the system will automatically spawn a PhysicsVolume that matches the scale, position, and rotation of the water volume. This will allow characters with the OceanSwimmingComponent to swim within the defined area.
-
Debug Settings
- The Debug Enabled option will display the boundaries of the water volume in-game and send
PrintString
messages when overlap events occur. - Enabling debugging is helpful for ensuring that the water volume is correctly configured and that actors are interacting with it as expected.
- The Debug Enabled option will display the boundaries of the water volume in-game and send
Considerations for Water Volume Integration
-
Importance in Buoyancy: The Water Volume plays a vital role in buoyancy by defining which areas are affected by water physics. Without correctly configured Water Volumes, actors with buoyancy components will not interact properly with water, leading to unrealistic or non-functional behavior.
-
Number of Water Volumes Required: The number of water volumes needed depends on the complexity and scale of your project. Each distinct body of water or part of the ocean that you want to cover requires a separate water volume. Plan accordingly based on the number of lakes, rivers, or ocean parts in your scene.
-
Collision and Overlap Events: Ensure that all objects intended to interact with the water (e.g., to float or swim) have Generate Overlap Events enabled and have suitable collision settings. This is crucial for allowing the physics interactions between actors and the water volume.
-
Initial Overlap Considerations: The Initial Overlap Check helps detect all actors within the volume at the start. Disabling it can improve performance but may result in some actors not being detected initially, which could affect their ability to float or swim correctly.
Example: Using Water Volume with a Simple Actor
In this example, we'll demonstrate how to add a Water Volume to allow a simple cube to interact with water by floating or enabling swimming capabilities.
-
Create a New Actor
- Start by creating a new Blueprint Actor and name it
BP_SimpleWaterCube
. - Add a Static Mesh component to this Blueprint and set it to a Cube mesh (you can use the default cube provided by Unreal Engine).
- Start by creating a new Blueprint Actor and name it
-
Add the OceanBuoyancyComponent
- Add an OceanBuoyancyComponent to your
BP_SimpleWaterCube
. - This component will allow the cube to float on water. Make sure the cube has Generate Overlap Events enabled in the Collision settings.
- Add an OceanBuoyancyComponent to your
-
Place the Cube in the Scene
- Drag
BP_SimpleWaterCube
into your scene. Ensure it is located above or within the Water Volume that you will add in the next step.
- Drag
-
Add the Water Volume
- Add a Water Volume to your scene from the Oceanology plugin. This volume will define the area of water where actors can swim or float.
- Configure the Oceanology Water parameter by selecting a water body from your scene (e.g., an ocean or lake).
-
Adjust Volume Size
- Adjust the Box Extent parameter to ensure the volume covers the desired area where the cube will float. This ensures that the cube interacts properly with the water.
-
Enable Buoyancy and Swimming
- Enable Buoyancy in Area to allow the
BP_SimpleWaterCube
to float within the volume. - If you wish to allow characters to swim, also enable Swimming in Area to make the volume swimmable for actors with the OceanSwimmingComponent.
- Enable Buoyancy in Area to allow the
-
Test the Scene
- Play the scene and observe how the cube floats on the water. You can adjust the position of the Water Volume or modify the cube’s buoyancy settings to achieve the desired behavior.
- Use the Debug Enabled option to visualize the boundaries of the water volume and confirm that the cube is correctly overlapping with it.
This simple setup will help you understand how to configure the Water Volume and integrate buoyancy into an actor, allowing for a more dynamic interaction with water bodies in your project.
Summary
By setting up the Water Volume properly, you can create realistic areas of water that actors can interact with, allowing for natural buoyancy and swimming behaviors. Adjust the Box Extent to define the desired area, enable buoyancy and swimming, and configure collision and overlap settings to achieve a fully interactive water environment.
For any additional support or advanced use cases, please refer to our demo levels or join our Discord community. There, you can find more examples, share experiences with other users, and get answers to specific questions.
With a well-configured Water Volume, your actors will be able to float and swim realistically, adding to the immersion and quality of your project.