How to Create an Area of Swimmable Water
The real world is full of areas of water, such as oceans, lakes, and swimming pools. When humans enter these areas of water, they can float and swim on the surface or dive deep underwater. In ParaSpace, we can also create areas of swimmable water with just a few simple steps.
Step 1: Create a Water Surface in the Scene
First, you need to create a water surface in the scene, which can be a surface of river, lake, or swimming pool. Please note that the water surface must be parallel with the XZ plane and have no changes in height. You can find many art resources for water surfaces in the Unity Store.
Step 2: Set Up a Collider for the Water Surface
Now comes the crucial step. We need a collider to demonstrate the volume of the water, and this collider must be configured with length, width, and height to accurately describe the 3D space where characters can swim. The default BoxCollider for the water surface is not recommended because of its small height.
Step 3: Add a Water Component to the Water Surface
Add the ParaWaterArea component to the object with BoxCollider to mark object as an area of water. Within the bounding box of this object, Avatars will enter the swimming state.
Step 4: Add Underwater Fog
When the camera enters the scope of the water collider, the component will set up global fog effects to simulate the underwater camera effects. The parameters to be specified are exactly the same as the Fog parameters in "Lighting" > "Environment" in Unity. For details, see the figure below:
Reference: https://docs.unity3d.com/Manual/lighting-window.html
Updated over 1 year ago