Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to move colliders #267

Open
kentbarber opened this issue Nov 8, 2019 · 2 comments
Open

How to move colliders #267

kentbarber opened this issue Nov 8, 2019 · 2 comments

Comments

@kentbarber
Copy link
Contributor

I can't seem to get colliders moving and interacting with the fluid how I expect it to.

I have a LevelSetLiquid that is half full with fluid. I then move a sphere in from outside of the domain that slowly moves through it.

I am moving it by setting the transform of the colliders Surface3.

surf->transform.setOrientation(jet::QuaternionD(quat.w, -quat.v.x, -quat.v.y, -quat.v.z));
surf->transform.setTranslation(jet::Vector3D(p.x, p.y, p.z));

But I think I may need to add velocity to the RigidBody as well, but I tried adding linearvelocity to it but it doesn't seem to work.

What happens is I see some slight affect on the fluid as the sphere moves in. But I am expecting the sphere to completely push the entire fluid, which it doesn't.

I will try to get another gif to you later today to demonstrate the issue, but if you are able to provide an example where I could manually set the location of objects before the solver->update method is called that would be great. I am not using your callback system due to the way my code is structured.

@kentbarber
Copy link
Contributor Author

kentbarber commented Nov 8, 2019

Here is a gif illustrating the current issue I am having. Most likely a user error on my part, but if you have any ideas of how to allow for this type of moving collider that would be great.

collisionproblem

@doyubkim
Copy link
Owner

Thanks for reporting this! I think what you did is correct -- set the transform of surface and velocity of the rigid body. (And now that I think of it, the API itself might be confusing. Rigid body collider should have the capability to move around the collider.)

The artifact you are seeing might be the result of the lack of voxels between the sphere and the walls. Looking at the mesh, it seems like a couple of voxels only. I suggest testing with a smaller sphere (like, the diameter being 1/3 of the domain size) and see what happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants