Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Cloth to simulate slime
#29
(29-03-2021, 11:35 AM)akayashi1212 Wrote: thank you! but that was not what i mean. i can get all particles i want in finger shape, but i don't know how to make it look like finger shape. when i change Y position of it, it look like video. When i use Velocity/externalForce, all of particle down. I don't want change the position of another particles i'm not select like video.
video: https://www.youtube.com/watch?v=CAEbkiKxaZs

This isn't really related to Obi, it's basic math. If you want to have an ellipsoidal shape for the user's finger, you can use an anisotropic support function (as opposed to an isotropic one). This is just math lingo for a shape that's not radially symmetric, like a circle. So what you do is calculate the distance from the user's finger to all particles, pass the distance to your support function, and it will tell you which particles to move and how much. I can't really be more specific without writing the code for you.

(29-03-2021, 11:35 AM)akayashi1212 Wrote: And the cloth is more elastic, how to decrease it ?
You can increase the cloth's compliance (expressed in meters/newton). That will make it more elastic. See:
http://obi.virtualmethodstudio.com/tutor...aints.html

(29-03-2021, 11:35 AM)akayashi1212 Wrote: I want make it look like the video, and i know obi cloth can do it. But i don't understand Obi Cloth's API.
video: https://www.youtube.com/watch?v=c5tGB6k6240

The video shows a circular shape when the user presses. This can be accomplished simply by calculating the distance from every particle to the user's finger, then moving these particles closer than a distance. All you need to do is iterate trough the solver.positions array and use Vector3.Distance with each one, should be very simple:

Code:
for (int i = 0; i < cloth.solverIndices.Length; ++i)
{
    int solverIndex = cloth.solverIndices[i];
    float distance = Vector3.Distance(cloth.solver.positions[solverIndex], <user finger>);

    //use your support function here, for instance a step function with radius 0.7:
    if (distance < 0.7f)
    {
    // move particle
    }
}

kind regards,
Reply


Messages In This Thread
Cloth to simulate slime - by arrnav96 - 09-09-2018, 06:06 AM
RE: Cloth to simulate slime - by josemendez - 09-09-2018, 11:32 AM
RE: Cloth to simulate slime - by arrnav96 - 10-09-2018, 11:17 AM
RE: Cloth to simulate slime - by josemendez - 10-09-2018, 11:41 AM
RE: Cloth to simulate slime - by arrnav96 - 10-09-2018, 11:55 AM
RE: Cloth to simulate slime - by josemendez - 10-09-2018, 01:45 PM
RE: Cloth to simulate slime - by arrnav96 - 10-09-2018, 03:47 PM
RE: Cloth to simulate slime - by josemendez - 10-09-2018, 03:56 PM
RE: Cloth to simulate slime - by arrnav96 - 10-09-2018, 04:03 PM
RE: Cloth to simulate slime - by josemendez - 10-09-2018, 04:05 PM
RE: Cloth to simulate slime - by josemendez - 10-09-2018, 04:27 PM
RE: Cloth to simulate slime - by arrnav96 - 11-09-2018, 09:25 AM
RE: Cloth to simulate slime - by josemendez - 11-09-2018, 10:32 AM
RE: Cloth to simulate slime - by arrnav96 - 11-09-2018, 10:25 PM
RE: Cloth to simulate slime - by josemendez - 12-09-2018, 08:09 AM
RE: Cloth to simulate slime - by arrnav96 - 12-09-2018, 01:01 PM
RE: Cloth to simulate slime - by josemendez - 12-09-2018, 02:26 PM
RE: Cloth to simulate slime - by arrnav96 - 12-09-2018, 03:44 PM
RE: Cloth to simulate slime - by josemendez - 12-09-2018, 04:45 PM
RE: Cloth to simulate slime - by arrnav96 - 19-09-2018, 10:29 PM
RE: Cloth to simulate slime - by josemendez - 22-09-2018, 02:17 PM
RE: Cloth to simulate slime - by arrnav96 - 30-09-2018, 03:35 PM
RE: Cloth to simulate slime - by arrnav96 - 06-10-2018, 03:47 AM
RE: Cloth to simulate slime - by akayashi1212 - 26-03-2021, 10:00 AM
RE: Cloth to simulate slime - by josemendez - 26-03-2021, 11:03 AM
RE: Cloth to simulate slime - by akayashi1212 - 27-03-2021, 04:24 AM
RE: Cloth to simulate slime - by josemendez - 29-03-2021, 09:59 AM
RE: Cloth to simulate slime - by akayashi1212 - 29-03-2021, 11:35 AM
RE: Cloth to simulate slime - by josemendez - 31-03-2021, 10:09 AM
RE: Cloth to simulate slime - by akayashi1212 - 31-03-2021, 02:47 PM
RE: Cloth to simulate slime - by josemendez - 31-03-2021, 06:21 PM
RE: Cloth to simulate slime - by akayashi1212 - 01-04-2021, 03:27 AM
RE: Cloth to simulate slime - by josemendez - 01-04-2021, 08:40 AM
RE: Cloth to simulate slime - by akayashi1212 - 01-04-2021, 09:57 AM
RE: Cloth to simulate slime - by josemendez - 05-04-2021, 12:06 PM
RE: Cloth to simulate slime - by akayashi1212 - 07-04-2021, 03:35 AM