30-03-2020, 11:43 AM
(This post was last modified: 30-03-2020, 12:03 PM by Andrew Graham.)
(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