03-01-2018, 10:39 AM
(03-01-2018, 08:26 AM)hmhmhm Wrote: Hello,
I'm new to Obi Fluid and in the process of getting familiar with it.
I'm trying to have a very simple 2D scene, similar to 'Simple Fluid' in the Sample Scene folder.
I start a new scene, add an Obi Emitter (with solver), and turn it 90 degrees on the x-axis so it emits downward.
I then add an empty Game Object, and add 'Rigidbody 2D', 'Box Collider 2D' and 'Obi Collider 2D (Script)' to that object. As per the instructions, I make sure the emitter and game object are in different layers.
When I run the scene, two unexpected things happen:
1. The Obi particles 'enter' the object, i.e. they don't bounce off the surface, some of them even 'fall through' the object.
2. When I switch to 3D view, and have a look from the side, I can see the particles are not remaining in the 2D plane (z=0), i.e. they move backwards and/or forward once they hit the object.
Eventually I would like to create a simple bucket and fill it with fluid in 2D. How do I best go about this, so the fluid stays a) in the 2D plane, and b) in the bucket. Also, is there an easy way to fill the bucket when the scene gets executed, i.e. without having to 'emit' the fluid into it first, which takes a while?
Thank you!
Hi,
Regarding collisions, you need to set the collider and the emitter in different phases, not layer (as stated in the docs: http://obi.virtualmethodstudio.com/tutor...sions.html). As long as the collider is in one of the layers selected for collisions by the ObiSolver (the default layer is one of them), you do not need to tinker with layers. In your case, the solution would be to either set the emitter's phase to 1, or the collider's phase to 1.
To create 2D fluid, you need to enable 2D mode in your ObiSolver component. (ObiSolver->Parameters->Mode: 2D). If you don't, fluid will be simulated in 3D space by default. Mixing 2D colliders with 3D simulation will cause the colliders to be regarded as thin sheets, and collisions will be easily missed.
To fill an area with fluid, you can use the ObiEmitterShapeSquare component instead of the default disk shape. First remove the ObiEmitterShapeDisk component, add ObiEmitterShapeSquare and set the amount of particles to be that of the amount of distribution points in the shape.
Note that you can also create your own emission shapes by extending the ObiEmitterShape class, in case the included ones (rectangles, disks, etc) are not enough for your purpose.
cheers!