20-05-2021, 07:43 AM
(This post was last modified: 20-05-2021, 07:44 AM by josemendez.)
(19-05-2021, 04:49 PM)DryGinStudios Wrote: Ok, thanks for all the information! I'm tweaking performance and I continue my prototype. I got one quick question. I'm trying to put textMeshPro over the liquid and it's not working.How can I put textmeshpro over the liquid? Thanks!
Hi!
Being transparent, fluids are renderer after all opaque objects. Then, the z-buffer is used to discard fragments that lie behind already rendered objects.
Whether an object is considered transparent or opaque, depends on the shader it is using. What material/shader are you using for your text?
(19-05-2021, 04:49 PM)DryGinStudios Wrote: I even tried 2 camera but the liquid is draw on both camera even if I put NONE for culling mask.
Fluids are not an "independent" object so to speak, rendering is a full-screen post process. So they're unaffected by culling masks.
(19-05-2021, 04:49 PM)DryGinStudios Wrote: Oh yeah last question (sorry I ask so many questions). I see in the maze example that we can check for OnCollision and I integrated it and it work but what I need is more a OnTriggerEnter and OnTriggerLeave to know how many of the liquid particles are in the zone. What is your suggestion for the best way of doing this?
Enter/Leave events can be easily calculated from the raw list of contacts: If a contact appears in the list, but didn't appear last frame, it's an "Enter"event. Similarly, if a contact that appeared last frame does not appear in the current frame, it's an "Exit" event.
If a contact was there in the previous frame and is still there, it's an "Stay" event.
If you don't want to write your own, you can use the ObiContactEventDispatcher component for this: sorts the contact lists, and determines enter/exit/stay events in linear time. These are exposed as UnityEvents that you can subscribe to. You will find it at /Obi/Scripts/Common/Utils/ObiContactEventDispatcher.cs.