NVIDIAGameWorks / FleX

Other
650 stars 100 forks source link

Tips for creating a flimsy plastic tube #81

Closed galapaegos closed 4 years ago

galapaegos commented 5 years ago

Hello,

I'm looking for any tips for creating a very small flimsy plastic tube, which I want to use to represent a cochlear implant. My model is very small, and it internally has all the particles in a line. Currently, I am using NvFlexExtCreateSoftMeshSkinningto create the particles and springs, and the representation looks like a rope. The rope works for now, but I would like it to be a bit more rigid and bend when it collides with a surface. If I hold the implant still, it shouldn't move or sway, if I shake it pretty quickly the implant bends and will move back to its original position when done shaking.

My first question is how to (stiffen?) the particles to stay better connected. Here is a scene in the flex demo with the implant: image The particle I grabbed (Particle 46) is all the way at the top, and is a very large distance from the neighbor particles. When I grab this particle, is there a way to keep the other particles closer to the picked particle? Any stiffness above 1.0 seems to break it.

This leads to my second question. I am using a 6-DOF input device that I want to attach the floating particle to, and have the whole collection of particles rotate and move based on this input device. I have been trying to use the NvFlexExtMovingFrameUpdateand NvFlexExtMovingFrameApply in order to grab the transform from the 6-DOF input device and apply accordingly but this places the particles outside of the work area (and increases each frame). Setting the position for Particle 46 to the position of the 6-DOF input device is more in line with what I am after, but I still need to apply a rotation to this set of particles. Can I utilize the NvFlexExtMovingFrameApply rotation code just to rotate around the center particle, or am I missing something important?

Any assistance is most appreciated, thanks! -brad

mmacklin commented 5 years ago

Hi Brad,

The main thing to increase stiffness is to increase the number of substeps or iterations. Collision detection is performed once per-substep so while they are often more effective than iterations they're also more expensive.

Cheers, Miles

galapaegos commented 5 years ago

Thanks Miles, this does help some.

I think a soft mesh may not be what I'm after for representing the implant. I can't rotate these points as a group, they always dangle like a rope if I use a fixed position. If I translate/rotate too quickly, they explode.