- Home /
Make particle system cover a part of the parent, depending on the the part of the object that is colliding
So Here is the situation...
My game is all in 2D.
I have a mass of water that has a collider with trigger.
I have a class that controls the objects that get in water, adding to them a particle system to emulate bubbles of water that will stay there till the object is out of water.
I want that particle system to have the size of the object when the object is inside water, but if the object has a part of it out of water and a part in, I want the particle system to cover only the part of the object that is inside water.
When the object is always straight what I do is to calculate the intersection between the surface of the water and the object vertical lines, and then make some calculations with the scale of the particle system to make it appear only in the down part, from the intersection to the bottom, and width same as the object.
The problem is if the object rotates, then this doesn't work.
Does anybody has any idea about how to make the particle system cover the part of the object that is inside water?
Your answer
Follow this Question
Related Questions
Particle System Appearing 2D 2 Answers
OnTriggerEnter2D not working 2 Answers
Unity2D - OnTriggerEnter2D not working 1 Answer