Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Temporarily make fluids in a container ignore other colliders/fluids
#2
(21-06-2024, 03:31 PM)Tobias Wrote: Hello,

I'm new to ObiFluid and I'm currently working on a 2D bartender game where you can grab glasses with fluid, move them around and pour the fluids into other glasses (or onto the shelves).

For example, I'd like this to work:
  • Drag and drop the red fluid glass from below through the upper shelf collider and through the blue and green glasses without affecting the liquids at all - it should just pass through it.
  • Rotate the red fluid glass so the red fluid pours out. Once the red fluid has left its glass it should be stopped by any other glass (i.e. fill those glasses and mix with any fluids inside) or the shelf.

So, in short, I'd need a *grabbed glass with liquid* ignore all non-grabbed-glass colliders/liquids, and *liquid that has left a grabbed glass* to normally interact with the world.

Liquids can mix, so I don't think I could do anything like "liquid from the red emitter behaves differently" - it might be glass mixed with red and blue liquid that is grabbed, while other glasses also already have red or blue liquid.

I see two ways this could happen:
  • If I make the simulation 3D with very flat models, it would still look 2D in an orthographic camera and I could use the Z-axis to make a grabbed glass and its contents ignore any other collider. When the fluid leaves the grabbed glass trigger volume because it is poured I could adjust the Z-position of those now-outside-the-glass fluid particles back to the Z-position that everything non-grabbed is on.
  • If there is a way to have multiple simulations and to transfer colliders/fluids between simulations, I could temporary make a grabbed glass and its fluid a separate "grabbed glass" simulation and return any fluid that leaves the grabbed glass to the "main" simulation.

Do those ways sound possible? Is there any other (maybe better?) way to achieve this?

Hi!

Either approach should work fine. Note however that colliders are shared among solvers, so in order for the fluid to collide with some colliders but not others you will need to change the fluid/collider collision filters. See “collision filters” here:
https://obi.virtualmethodstudio.com/manu...sions.html

Also check out the bottom of this page, regarding setting collision filters at runtime:
https://obi.virtualmethodstudio.com/manu...sions.html

Kind regards,
Reply


Messages In This Thread
RE: Temporarily make fluids in a container ignore other colliders/fluids - by josemendez - 25-06-2024, 04:49 PM