Jump to content

Custom Gravity Workflow?


whitecanvas

Recommended Posts

Hello everyone, 

I am trying to achieve a custom gravity force, an inverse radial sort to say which would allow me to attract DOP objects to the walls of an arbitrary geometry, in this case a tubish shape. Until now I could come up with this:

- Assigning to the Dop Gravity Force the Normal value of the primitives of the attractor, with a prim function, but it only takes into account the normal of the single primitive specified.

- Creating a radial gravity , negate it and make the tube a collider. The problem here is that since the force is applied in every direction, the object get attracted also where there is no geometry and therefore they don't act as if they where dropped on the ground and keep sliding and rolling.(Idea discarded because it would always push in every direction) 

- Creating a SDF from the geometry and use the volume gradient to create a force that attracts stuff towards it. Here as well the objects keep rolling and seem to be attracted where there is no geometry regarless of how close to the surface i drop them. In this particular case I don't know what is not working, maybe because I am using the volume for generating the force but the surface for collisions? I think I am missing something inside the vopnet.


Could someone point me toward the solution? 

Thank you for you help and sorry for the long reading

Attempts attached

Custom_Gravity.hip

Link to comment
Share on other sites

couple of things, I focused only at SDf force as that's the way to go:

- you are using Isooffset to generate SDF, which is slow and may introduce artifacts, consider using VDB From Polygons

- your volumegradient is not sampling the SDF, but the default cube geo, you have to point it to your geo

- your volumegradient is sampling using v, it should sample at P position

- you are adding P to result of your gradient, while the gradient direction is already parallel to the tube normal, so you shouldn't mess with it more, just negating and normalizing is fine

- VOP Force is old and may be slow, in your case when using RBDs consider using POP Force Instead

 

here is the file with all the changes

also has both VOP Force and POP Force approach

Custom_Gravity_fix.hip

  • Like 1
Link to comment
Share on other sites

Thank you as always, Tomas

I knew i was messing up the vop :/

Now this works great, but the cubes keep moving weirdly and never seem to stop. What is this due to? i thought that upping the substeps could solve it but it is actually worse and the cubes go crazy.

Regarding this "- VOP Force is old and may be slow, in your case when using RBDs consider using POP Force Instead", would it also work with constrained RBD packed objects?

Thank you again

Frankie

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...