Select Page

Udon Swim System

How to Implement the Udon Swim System in Unity for VRChat #

The Udon Swim System is a valuable tool for creating underwater experiences in Unity scenes for VRChat. Here’s a step-by-step guide to help beginners set up and use the Udon Swim System:

Step 1: Import the Udon Swim System Package #

  • Open your Unity project.
  • Go to the “Assets” menu and select “Import Package” > “Custom Package.”
  • Locate and select the Udon Swim System package file you’ve downloaded, then click “Import.” Unity will import the necessary assets into your project.

Step 2: Set Up Your Scene #

The easiest way to get this working out of the box is to copy the swim system from the sample template into your world and modify to fit your needs. You will also need to add the main Swim System prefab to your world to link the colliders to the Swim System.

Alternatively: You can drop in the WaterTriggerVolume prefab, WaterVolume prefab and the main Swim System prefab onto your scene.

The ExampleScene #

The example scene is basic and functional. Copy the WaterVolume object hierarchy and WaterTriggerVolume with the copy and paste it into your scene.

Minimal Setup #

The swim system doesn’t come with any fancy water shaders or underwater visuals or prefabs for pre-made pools. In the example below simple cube blocks around the edge of the collider and some stairs would be needed to. However, this is just a technical guide to get the bare minimum of the asset to work.

End Result (Hierarchy) #

Example of naked Swim System setup #

Notes & Technical Guide #

Simplified Installation and Setup Guide #

1. Prerequisites:

  • Unity 2019.4.31f
  • VRChat Creator Companion Unity project
  • UdonSharp package from VCC

2. Installation Steps:

  • Import SwimSystem unitypackage into your project.
  • Drag and drop the ‘SwimSystem’ prefab into your scene.
  • Add the ‘WaterVolume’ prefab to create water areas.

Understanding the Prefabs #

SwimSystem Prefab:

  • Purpose: Manages swimming and diving mechanics.
  • Placement: Can be placed anywhere accessible to players.
  • Settings Panel: Optional, can be deactivated or deleted.

SwimSystemPlus Prefab:

  • Enhancements: Adds breath mechanics, bubble effects, and underwater sounds.
  • Usage: Similar to SwimSystem but with additional features for a more immersive experience.

WaterVolume Prefab:

  • Function: Represents a body of water in the scene.
  • Placement Tips: Can be scaled but avoid tilting. Use mesh colliders for complex shapes.

AirPocket Prefab:

  • Purpose: Creates air pockets within water bodies.
  • Placement: Inside WaterVolume prefabs for best results.

Scene Setup Tips #

  • Sample Scene: Use the included sample scene as a reference for setting up your own.
  • Collider Naming: Name surface colliders as “HRBK_SSWATER_RC_TOP” and bottom colliders as “HRBK_SSWATER_RC” for proper detection.
  • Water Surface Raycast: Adjust the frequency of raycast checks to optimize performance.

New Features in SwimSystem 2.1.0 #

  • Collider-Based Water Definition: An alternative to raycasting, use colliders to define water bodies.
  • Collider Placement: Ensure no vertical overlap and complete coverage of the water area’s bottom.

Prefab Toggling and Interaction #

  • Deactivation/Reactivation: Prefabs can be toggled without disrupting player interactions.
  • Player State Resumption: Player states are saved and resumed upon prefab reactivation.

Customizable Settings #

  • Sound Settings: Modify underwater ambiance and splash sounds.
  • Locomotion Settings: Adjust hand and full-body swimming mechanics.
  • Physics Settings: Tweak drag, buoyancy, and gravity settings for realistic underwater movement.
  • Advanced Settings: Control player movement mechanics with options like teleportation settings.

Important Tips #

  • Collider Orientation: Ensure proper orientation of mesh colliders for accurate water surface detection.
  • Air Pocket Usage: Use air pockets strategically for interesting gameplay dynamics.
  • Prefab Placement: Be mindful of prefab locations to ensure player accessibility and immersion.

Final Notes #

  • Familiarize yourself with all the settings in the SwimSystem prefab for fine-tuning your world.
  • Experiment with different settings to see their impact on gameplay.
  • Regularly check for updates and new features to enhance your VRChat world.

Powered by BetterDocs