Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ObiClothDragger question
#1
Jose,

I was wondering if there's a way to modify the default behavior of picking/dragging a mesh and letting go. It seems that the stretched part of the mesh always snaps back to its initial form. Is there a way to make the mesh transformation remain the way you left it after picking & dragging?
Reply
#2
Bump - Just hoping to get an answer from Jose or any other savvy user as to whether this is possible.  Huh
Reply
#3
(30-01-2018, 03:23 PM)rendezvous Wrote: Bump - Just hoping to get an answer from Jose or any other savvy user as to whether this is possible.  Huh

Hi there,

Just set the dragged particle's velocity and inverse mass to zero when the user releases it. That will fix it in place. See the last bit of http://obi.virtualmethodstudio.com/tutor...icles.html for info on how to do that.

Edit: To be more specific, modify the Picker_OnParticleReleased function of ObiClothDragger.cs so that it looks like this:

Code:
void Picker_OnParticleReleased (object sender, ObiClothPicker.ParticlePickEventArgs e)
{
    Oni.SetParticleInverseMasses(picker.Cloth.Solver.OniSolver,new float[]{0},1,picker.Cloth.particleIndices[e.particleIndex]);
    Oni.SetParticleVelocities(picker.Cloth.Solver.OniSolver,new Vector4[]{Vector4.zero},1,picker.Cloth.particleIndices[e.particleIndex]);
    picker.Cloth.Solver.RelinquishRenderablePositions();
}

As you can see, I simply replaced "originalMass" by zero and set the velocity to zero.
Reply