2D Procedural Water System With Buoyancy
Package contains procedurally generated water mesh with vertices manipulated using Hooke's law and simulates Buoyancy, and supports reflection, Just swap water material for personalized look.
This package contains two Blueprints, One for the Procedurally generated 2D water mesh and the other for the Floatable Sprites, Floatable Blueprint has an interface implemented on it which of course is included, also there is a Blueprint Function which I created for its reusability and hence is easily customizable, hence this function can be re-implemented in various scenarios according to your needs.
I have also included comments inside blueprints where possible, also below are some pointers to help you along.
If For any Reasons want to manipulate Verties of the mesh The Procedural Mesh is Generated as bellow:-
1 * * * 3
* *
* *
0 * * * * * 2* * * * * 4
2. Material for the water mesh is included and its instance has been applied on the Demo, the instance gives you the option to apply any texture you want and hence is dynamic.
3. When using Floating Object, add some pontoon array elements to it usually 1-3 will do the trick, for convenience, I have made them instance editable with 3d widgets shown, so it will be quite easy to manipulate from the editor itself.
4. When Using Floatable Objects keep in mind to add mass more than at least 600 since the mass has been used in alpha calculations of the force, and also you don't want your player to send your floatable object into multiverse just by touching it :).
5. All the manipulative variables have been created to be instance editable.
6. 2 Materials one for reflection and the other for normal water (Tileable and scalable).
Update Log:
V_2.0: Improved performance and Frame rate independence.
- Frame rate independence achieved (Tested at 15-60+ FPS).
- Timer by event rate depends on the delta time (OVERLAPPING= (0.8 * Delta time) & IDLE = (1.0 * Delta time) and caps at "0.03".
- Texture Tilling or stretching Feature available.
V_3.0
- Reflection feature added.
- Few minor Improvements.
Note:-
- Try to keep the no of iterations variable in the procedural mesh low as it can easily add up.
- Procedural mesh uses a Custom collision Object Channel Named "Water_Body", to be traced only for this specific type from Floatable Actor Blueprint, an instance editable variable has been defined for convenience.
Steps to define New Collision Channel:
Edit->Project_Settings-> Collision -> Object Channel->New Object Channnel-> Name "Water_Body"->Type "Overlap".
Technical Details
- Procedurally generated water mesh (Length and Hight User dependent).
2. Custom Designed Buoyancy, Using Blueprint Function.
3. Water Vertices manipulation using Hooke's Law (Highly Customizable.)
4. Works out of the box.
5. Works dynamically with editor exposed Variables.
6. Cost-effective (Uses Custom tick Type Event which Fires at max every 0.03sec.
7. Two Modes of water Displacement
* Idle-> Water moves with randomly applying small forces along vertices imitating motion.
*Overlapped-> Stops the idle Movements when overlapping starts moves according to the disturbance caused.
8. Highly customizable reflection feature, with dynamic render texture.
(Currently set in such a way that, Idle state is reached only if no overlapping occurs or 10 Sec after all overlapping end)
Number of Blueprints: 2
Number of Blueprint Functions: 1
Number of Interfaces: 1
Number of Sprites: 4
Number of Textures: 7
Number of Materials: 2
Material Instances: 1