We gonna make motion of underwater bubbles using Unity Shuriken particles system.
This tutorial is based on our current game Anoxemia:
I dont care about anything here. Just give me prefab :) -
Common and the most important part of tutorial.
Philosophy( skip it dude, anyway people never learn on others mistakes )
So why do they move that's way ? The reason is Physics. It is simple and complicated part of all tasks. The problem that designers never study physics so they do everything just like they see it and use wrong instruments as results, but anyway get quite acceptable but not accurate results. Even programmers often don't know anything about physics but I was lucky and sadly at same time studding at Physics department.
1. Bubbles is a big couple of air placed into water that trying to take spherical form.
2. Arhimed power is applied on a bubble so it moves up and increasing velocity
3. Bubbles become bigger because water pressure depend on depth. The deeper object the bigger pressure applied on it so they small.
4. Bubbles change it shape because of anisotropic of water and forces like colliding etc.
5. Bubbles movement looks like sin function with some randoms because of colliding each other.
1. Create Shuricen particle system
2. Main section of PS
Start speed set to 0 because we have no start speed on bubbles
(Your taste) Start Size set to 0.01 it is 1cm middle size of bubbles under water
(Your taste) Start life time to 1 how long our bubble is alive
Simulation Space set to world because we want our PS react on movement
(Your taste ) Emission set to rate at about 20 and Time
4. Uncheck Shape because particles often emitted from one point like hole of oxygen balloon
5. Uncheck velocity over life time because we dont need to control velocity if we control force
6. Check force over life time and set to random between two curves and setup curves as described here
By Y constant force and sin forces by XZ plan to give sin movement and set to world simulation space because we dont want to have troubles when we attach out PS to some object.
7. Set size over lifetime to growing because of bubbles growing
8. Need some artist help. My girlfriend helped me a lot, thanks Julia Maylina, love you. Draw 4 types of bubbles in a row for a bubbles deformation and setup sheet animation as follow.
Texture should looks like this:
Thats how we minimized a lot of components of Shuriken particles and improve perfomance by the way. But just a little bit :)