Fluid Surface Simulation for multiple objects

The water surface at the moment was limited to the trace input and the pawn. I wanted to try and find some way to make the simulation work for any objects. On the Beginoverlap and Endoverlap nodes, I removed the 'cast to' node and made it so that any actor overlapping can make the ripples. For some reason, didn't work and it seemed to only still work for the pawn. Then I remembered that the Mesh collision settings were set to pawn only. After setting to overlap all the blueprint works with multiple objects.

Begin and End Overlap for any overlapping objects however it only works per object and not for multiple objects
However, there were two problems with the blueprint. One is the BP only reacts to latest overlapping objects. The second being the blueprint reacting to one object at a time, so if I have two objects overlapping with the blueprint at the same time, then the surface will only choose one of the objects and make a ripple. I need to make it so it works with any object.

I had an idea where I use event tick instead of the Beginoverlap and Endoverlap nodes to fix the first problem and do a Foreachloop for each overlapping object. But then that left me confused with what to do after the Foreachloop of overlapping nodes. I wasn't sure how I can make it so that the object knows where to create the ripples when overlapped.

Initial Idea to make ripples with Foreachloop for overlapping objects

I did some googling and I came across Cyberalien's water simulation and downloaded his blueprint. His blueprint didn't seem to work in PIE (Play in Editor). After spending time studying his blueprint I noticed it used a similar concept where he also used the event tick and foreachloop except it was complete and had the solution to my problem. The blueprint was cool and it also had the functionality which controls size and strength of force splat material based on the velocity and the object bounds. After adding it to my blueprint there were still some issues with it so I made some changes of my own:
Complete version of Foreachloop with the help of Cyberalien's material

The first issue is that I didn't want the simulation to constantly make ripples which can make the blueprint quite expensive. The second issue is that the whole water simulation randomly flies off when the velocity of an object goes to zero because of the division. To fix this, I simply added branch before creating the ripple so it only makes a ripple if the velocity is above zero.





Comments

Popular posts from this blog

Environment Showcase Concepts

Distance Field water foam

World alignment (Tri-planar mapping)