This asset supports Unity 2018 even though it has been uploaded with a newer version. There is a lot of conditional code in order to make it work. If you can't install it in 2018, download it in a newer version and then copy the folder to your 2018 project.
In Unity 2018, open the Asset Store under Windows menu, find the asset in your assets list, and import into your project.
In Unity 2019+ use the manual page to learn how to install this asset
WaveMaker requires between 2 to 4 additional packages to be installed manually in your project depending on your Unity Version. These are the minimum versions that you should have:
If you don't know how to install packages or have problems doing it:
v2 WaveMaker requires some packages to be installed in your project depending on your Unity and Package Manager version. In 2019+ when those are not installed a warning will be displayed in the components, but in 2018 those are compilation errors.
To fix them, please visit the How to Install guide
v2 WaveMaker lies inside an assembly called WaveMaker. In that file the versions of the required packages are detected. This error arises just after importing the package, and seems like it can't detect the packages in some files and doesn't create the correct Visual Studio files. Delete .vs folder, and visual studio files (.csproj and .sln) in your project, and open the code again. It will regenerate the files. If it still doesn't work, you will have to clean up the Unity cache (delete Library folder, and Temp files) in the project folder and reopen the project. If it still persists, please contact me.
Use the Readme.pdf file included with the asset, or visit the tutorial section
Visit the descriptor section to read about this file.
Check if any of these is false:
WaveMaker applies forces to objects with rigidbodies the same way the Unity physics engine works.
Since the surface is divided in a grid and forces are applied on each vertex, there are aliasing problems . Try these solutions
This is a known problem due to the aliasing (grid) of the surface. It will be improved in the future. Please read the "Known Limitations" section in the main website to learn how to improve this.
This is a typical problem on any simulation. Some parameters will make the simulation unstable creating weird and increasing errors in play mode.
If you need higher resolution, you will have to keep your propagation speed low to avoid the warning. The problem with this is that waves will move very slowly. To fix this, set subtepping to 2 or maybe 3 maximum. This will allow to increase the propagation speed to the look you like.
But be warned: This will make the simulation take more processing time. Consider reducing resolution and try to keep substepping to 1.
This is a very common question. Using Unity meshes has the limitation of 56k triangles (that means for example 256x256 resolution in a square surface). Compute shaders would allow WaveMaker to have bigger and faster meshes generated inside the GPU.
The reason for this is simple: The Occupancy interaciton mode that allows Buoyancy is a two-way coupling system (the surface affects the interactors (which are Unity native colliders) and colliders can affect the surface.
In order to affect colliders outside the GPU, interaction data should be extracted from it, which is a very slow and would absolutely destroy efficiency. In Compute Shaders all should be done inside the GPU, absolutely everything.
Since we use Colliders and WaveMaker doesn't implement a whole physics engine inside the GPU, which would go out of the scope of this asset, we can't really use compute shaders. There is a possibility to move the Velocity interaction mode, which is a one-way coupling into Compute Shaders in the future, but right now there is a lot of room of improvement with Burst and Jobs.
A surface is a game object with a WaveMaker Surface component and it shows a mesh and simulates it. The mesh and all needed components are automatically created and the mesh is updated each frame.
Create a surface fast using "3D Object -> WaveMaker -> WaveMaker Surface" in the GameObject menu or right clicking on the Hierarchy view.
The interactors are game objects with a WaveMaker Interactor component. They can interact with the surface to make it move. They can also be moved by the surface in certain cases.
Create a basic sphere / box / capsule interactor using "3D Object -> WaveMaker -> WaveMaker Interactor" in the GameObject menu or right clicking on the Hierarchy view.
When using Velocity based interaction, if your interactor moves very inconsistently (trembling, violent movement), you can use the velocity parameters to smooth out the velocity and see how it looks.
These will make simulation look wrong.
As soon as you create a WaveMaker Surface component, you will be asked to attach a Descriptor file. This scriptable object file is stored in your project and can be created in the Project View via the right click Create menu.
Descriptors store the resolution as well as the cell's properties. They can be shared between surfaces.
As soon as you attach the file, the mesh will be created and the parameters will be available. When modified, via the Inspector of the Descriptor or via the Wave Maker Surface component, all Surfaces using that Descriptor will be updated.
The size of the Surface can be set via these values in the Surface component. You can also set it using the scale of the game object, but since the transform's scale can be affected, it is recommended to set it via the local mesh size box, independent of the transform.
These parameters affect the simulation of the water even when there are no interactors touching it or which interaction type is selected
By default set it always to 1. Increase it ONLY if you see a warning or the fluid is unstable. This happens when the resolution is too high or the propagation speed for that resolution is too high. A warning is shown in the surface component. Reduce resolution, reduce propagation speed or increase the value until the warning dissapears. Every FixedUpdate() the fluid simulation will be executed this number of times, so try to keep this value low!.Affects Efficiency
The speed of the waves. A warning will appear if the value is too high for the current resolution. For very high resolutions it is not possible to set a big speed value. If you need more and you can't reduce resolution, incresase the substeps by using the Substep parameter.Affects stability
How fast waves dissapear in the surface. This will make your surface look creamy or like mercury. A value of 0 will never allow the surface to get asleep. A very extreme value could cause inestability, but in very excepcional cases.
To reduce mesh noise and spikes in the surface if you don't like how it looks, you can increase resolution or use this parameter (as well as shaders!). In general you need a very high value to see the effect.
This parameter generates unrealistic fluid effects and should not be used as a substitute to propagation speed. This will let you create slow-down and speed-up effects.
This important choice changes the way interactors change the surface. The choice affects tremendously the efficiency of your scene and memory usage, so be sure to understand both methods!
Available from v1, this methods detects interactors touching a very thin layer around the plane and compares relative velocities between the surface and the interactors in order to generate the waves.
This method is the fastest one of all, and its efficiency has been improved since v1 tremendously. Depending on the resolution of your fluid and a good choice of parameters to allow them to get asleep, you will be able to add many of them in the same scene.
When should I use it? If you just need water simulating or you want to add many of these in your scene. It allows for all sorts of orientations and positions inside any hierarchy. You will not have advanced features like buoyancy, drifting and others. This will suffice for most of the cases.
New in v2, this new method takes into account a box of space underneath the surface that detects interactors and calculates how much volume they occupy.
Since the occupancy is calculated, apart from the waves generated by the objects, we can use that to generate a bunch of advanced effects like floating forces (buoyancy) and drifting forces (horizontal floating forces) and much more that will come in future versions.
When should I use it? In general, horizontal surfaces where you need the advanced features like buoyancy or drifting. Be aware that they get asleep less often if objects are floating on them. Otherwise, always use the Velocity mode instead, which runs a lot faster and consumes much less memory.
There is no default value for these. Play around with values. Since this effect is based on a fake physics effect, you can use these to scale the size of waves generated by horizontal movement and vertical movement relative to the surface. Set to 0 to remove any of them.
Since this method compares relative velocities between surface and interactors, huge waves can be generated due to very high speeds. To avoid huge waves, set to a speed in units per second that cannot be exceded.
Since this method compares relative velocities, this will ignore any interactor that moves relative to the surface at this given speed in units per second. Useful to ignore tiny differences and keep the surface asleep.
How deep the volume is. It is visible as a collider underneath the surface in Unity units. To improve numerical precision keep it as small as possible, but set the size so any interactor touches the bottom. If objects leave or enter the box through the bottom, waves will be generated on top.
If disabled, the surface will not be modified by interactors and will stay flat. This improves efficency, and can be used in cases where you only want buoyancy. Disabling buoyancy too will make no sense, in that case, disable the whole component.Affects Efficiency
Waves are generated more realistically with this interaction method, but you can use this parameter if you want smaller waves (less than 1) or bigger waves (more than 1). Keep the value at 1 by default.
Set this to what you calculate will be the maximum number of interactors touching this surface at the same time. The smallest, the fastest the simulation and the less memory occupancy. If set wrong, some will be ignored and simulation / occupancy calculation could have unexpected outcomes. An error is output if the "Warning log" is enabled.Affects Efficiency
Each interactor inside the area underneath the surface will have a number of cells assigned in the X-Z plane. If the value is too low, noise will happen on the surface and objects will not fully float. If the "Warning log" is enabled, you will see warnings whenever this happens. This value has to be the smallest you can to optimize the computations, so use the log to test your bigger interactors.Affects Efficiency
If you allow several objects to be one above the other in the same surface X-Z position, increase this to the minimum you will allow. If set wrong, noise will happen in the surface. Keep it in 1 if you know objets will never overlap to make simulation faster.Affects Efficiency
Using the rigidBody mass, the density of the surface liquid, forces will push the object upwards until it is stable. Otherwise objects using gravity will pass through it.Affects Efficiency
Apart from vertical forces, other forces will be generated by the waves touching the interactors, moving them around the surface horizontally.Affects Efficiency
Set to 1 by default. Use a real density value to make objects float using it. You must combine it with wave simulation properties to make it look realistic. Find the values online (Water is 1, Oil is 0.92, Mercury is 13.60, etc). High density fluids will make interactors float a lot, lower values will not have that strength to rise objects.
Used to smooth out the buoyant forces that can generate infinite jumps or non-stoppable rotations that can occur on some types of shapes like boxes, which are not very stable on a surface where everything is aliased (forces applied on the vertices of the mesh). If you still have problems, try to use less squared colliders as interactors.
Interactors are detected by default on each vertex of the mesh. The less resolution, and bigger size, the more obvious are the aliasing problems when moving objects around. Select a higher value to increase the number of raycasts on each cell and the aliasing effect will be reduced. This increases a lot the number of raycasts so try to keep it low. Use this to avoid increasing resolution.Affects Efficiency
Keep this log enabled while developing your project to ensure your settings are correct in Occupancy Mode. It will guide you when objets detected are too big than the number of cells you set or more than the allowed amount of interactors are detected, etc. Important Node: The overlap limit is not tested in v2.Affects Efficiency
Unity in WebGL doesn't support multithreaded code. These live demos will execute slower depending on your computer but at least you can play with them online.
© 2021 Lidia Martinez Prado - http://www.lidia-martinez.com