Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Freezing and moving obi fluid
#1
Hello,

I am using Obi Fluid for a game, and I am very impressed. However, I am stuck at something that I thought would be easy.

I am pouring a viscous fluid over an object, and I want to freeze the motion of the fluid and then rapidly move the object to another position with all the liquid going with it and staying in place. The solver and the emitters are children of the object.

Instead, all the liquid flies off.

If I disable the solver or the updater, the fluid stays fixed in world space and the object moves away from it.

Am I missing something obvious?

Many thanks,
Andrew
Reply
#2
(27-03-2020, 08:37 PM)Andrew Graham Wrote: Hello,

I am using Obi Fluid for a game, and I am very impressed. However, I am stuck at something that I thought would be easy.

I am pouring a viscous fluid over an object, and I want to freeze the motion of the fluid and then rapidly move the object to another position with all the liquid going with it and staying in place. The solver and the emitters are children of the object.

Instead, all the liquid flies off.

If I disable the solver or the updater, the fluid stays fixed in world space and the object moves away from it.

Am I missing something obvious?

Many thanks,
Andrew

Hi Andrew,

If the hierarchy looks like this: object->solver->emitter, moving the object should suffice, as the simulation is performed in solver space. When moving the object around, both the object and any fluid poured over it should move. There's only two things to keep an eye on:

- All world-space inertia scales in the solver are set to zero (if they aren't, a percentage of the solver movement inertia will be applied to the particles)

- The object should be moved in FixedUpdate simulation takes place in the frame. If you move it after (by translating it in Update(), for instance), particles will "see" the object with a 1-frame delay, some will start the frame inside of the collider, be projected outside of it by collisions and fly off. It's very important to update things in the correct order, you can't do things that affect physics outside FixedUpdate().

I've tested this with the included "FluidViscosity" sample scene and it works just fine. Let me know how it works for you.
Reply
#3
(28-03-2020, 11:42 AM)josemendez Wrote: Hi Andrew,

If the hierarchy looks like this: object->solver->emitter, moving the object should suffice, as the simulation is performed in solver space. When moving the object around, both the object and any fluid poured over it should move. There's only two things to keep an eye on:

- All world-space inertia scales in the solver are set to zero (if they aren't, a percentage of the solver movement inertia will be applied to the particles)

- The object should be moved in FixedUpdate simulation takes place in the frame. If you move it after (by translating it in Update(), for instance), particles will "see" the object with a 1-frame delay, some will start the frame inside of the collider, be projected outside of it by collisions and fly off. It's very important to update things in the correct order, you can't do things that affect physics outside FixedUpdate().

I've tested this with the included "FluidViscosity" sample scene and it works just fine. Let me know how it works for you.

Hi Jose,

Thank you for your quick reply. I've tested this in my project and I'm afraid I am getting the same results.
I also tried your suggestions in the fluidViscosity sample, and I get the same results there as well. This gives me hope that I am doing something wrong that you can help me with.
I am using this script to move the sphere in FixedUpdate:

public class FixedUpdateMove : MonoBehaviour
{
    [SerializeField] Vector3 m_trackedPosition;

    void FixedUpdate()
    {
        transform.position = m_trackedPosition;
    }
}


When I adjust m_trackedPosition in the inspector, the sphere moves around, and the fluid moves with it, but the fluid that is on the sphere splashes around. I need it to stay on the sphere as if I am not moving it at all.

I will try to send you a video to show you what I am seeing.

Note that I am happy for the simulation to freeze while the parent is being moved around. I just need to fluid to stay in place on the parent object.

Many thanks for your help,
Andrew
Reply