Help Cloth to simulate slime - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Cloth (https://obi.virtualmethodstudio.com/forum/forum-2.html) +--- Thread: Help Cloth to simulate slime (/thread-683.html) |
RE: Cloth to simulate slime - josemendez - 22-09-2018 (19-09-2018, 10:29 PM)arrnav96 Wrote: All that information is very useful, thanks. Again, my coding skills are very basic, apologies if I mixed the thread up with programming questions. Use a mesh that's not a flat plane, but has some folds. The one you show here should work fine. However, make sure that your export it with unit scale. (scale = <1,1,1>). 99% of the issues I see regarding exploding cloth are because the mesh has a random scale value, and the topology has a completely different one. The easiest way to get consistent scaling from your 3D package->Unity->Obi is to just use unit scale. RE: Cloth to simulate slime - arrnav96 - 30-09-2018 (22-09-2018, 02:17 PM)josemendez Wrote: Use a mesh that's not a flat plane, but has some folds. The one you show here should work fine. However, make sure that your export it with unit scale. (scale = <1,1,1>). 99% of the issues I see regarding exploding cloth are because the mesh has a random scale value, and the topology has a completely different one. The easiest way to get consistent scaling from your 3D package->Unity->Obi is to just use unit scale. This seems to have solved the glitch issue! Thanks for your useful advice. I'm pretty close to finishing this. Also, you mentioned in your previous post about using a radial function to represent a finger press. Could you shed some light on that? Specifically, where is the part in the ObiClothPicker script which attenuates the mesh, starting from the center point of touch towards the outside? I just want to use a radial equation according to the particle's distance from the center. If I'm majorly missing something about this code, it'd be great if there's a document explaining some method's such as what "cloth.topology.visualMap.Length" does. Code: if (Input.GetMouseButton(0)) RE: Cloth to simulate slime - arrnav96 - 06-10-2018 Bumping this thread RE: Cloth to simulate slime - akayashi1212 - 26-03-2021 (11-09-2018, 10:32 AM)josemendez Wrote: A finger is basically a circular (or ellipsoidal) shape. Using a radial support function you can displace particles to the border of the circle/ellipsoid, to make it look like the user is "pressing down" on the slime.Please help me! "Using a radial support function you can displace particles to the border of the circle/ellipsoid, to make it look like the user is "pressing down" on the slime.", Could you shed some light on that? RE: Cloth to simulate slime - josemendez - 26-03-2021 (26-03-2021, 10:00 AM)akayashi1212 Wrote: Please help me! "Using a radial support function you can displace particles to the border of the circle/ellipsoid, to make it look like the user is "pressing down" on the slime.", Could you shed some light on that? It just means to use some function of the distance between the particle and the point the user is pressing. You could use a constant function (all particles within some radius of the finger), or some kind of falloff function (smooth step, gaussian, etc). RE: Cloth to simulate slime - akayashi1212 - 27-03-2021 (26-03-2021, 11:03 AM)josemendez Wrote: It just means to use some function of the distance between the particle and the point the user is pressing. You could use a constant function (all particles within some radius of the finger), or some kind of falloff function (smooth step, gaussian, etc).thanks you for reply! have any function or parameter in solver/actor to do that? can you suggest me one? RE: Cloth to simulate slime - josemendez - 29-03-2021 (27-03-2021, 04:24 AM)akayashi1212 Wrote: thanks you for reply! have any function or parameter in solver/actor to do that? can you suggest me one? You have Vector3.Distance (https://docs.unity3d.com/ScriptReference/Vector3.Distance.html), which will return the distance between two points. One of the points should be your user's finger position (Input.mousePosition, or other depending on which input system you're using), and the other point should be a particle position. You can get these from Obi's particle API: http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html You can then just get the distance from the user's finger to all particles, and use that as input to your support function. RE: Cloth to simulate slime - akayashi1212 - 29-03-2021 (29-03-2021, 09:59 AM)josemendez Wrote: You have Vector3.Distance (https://docs.unity3d.com/ScriptReference/Vector3.Distance.html), which will return the distance between two points.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. And the cloth is more elastic, how to decrease it ? video: https://www.youtube.com/watch?v=CAEbkiKxaZs 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 RE: Cloth to simulate slime - josemendez - 31-03-2021 (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. 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/tutorials/distanceconstraints.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. 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) kind regards, RE: Cloth to simulate slime - akayashi1212 - 31-03-2021 (31-03-2021, 10:09 AM)josemendez Wrote: 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. Thank you very much for detailed reponse! But again, i mean i stuck at "move particle", not at select particle. i've tried move down the particle by change Y position like this code: "solver.positions[solverIndex] = new vector4(solver.positions[solverIndex][0], -2f,solver.positions[solverIndex][2],solver.positions[solverIndex][3])" and it very glitchy like the video. when i change particle velocity or externalForce, all particle in cloth move down too @@. Now i'm thinking about move particle to around finger shape ( by X and Z position) instead of move below finger shape ( Y position). Then, all i want to ask is: have any functions/parameters in Obi's API support me do it? thank you again for the best support ^^. |