Posts: 6,309
Threads: 24
Joined: Jun 2017
Reputation:
399
Obi Owner:
31-03-2021, 06:21 PM
(This post was last modified: 31-03-2021, 06:24 PM by josemendez.)
(31-03-2021, 02:47 PM)akayashi1212 Wrote: 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 ^^.
Hi!
Sorry for the confusion, we might be having communication problems .
I’m not entirely sure what you’re having trouble with. Moving the particles in the X or Z axis is done just like in the Y axis, but you change the first/third component of the position vector, instead of the second. There isn’t any need for functions or parameters to help you do this.
When you move a particle, all other particles will be affected by its movement (since particles are interconnected by constraints). You can change cloth parameters like distance constraint compliance or compression to change how nearby particles react to it.
If this isn’t what you mean, can you be a bit more specific, or maybe show an example?
Posts: 7
Threads: 0
Joined: Feb 2021
Reputation:
0
(31-03-2021, 06:21 PM)josemendez Wrote: When you move a particle, all other particles will be affected by its movement (since particles are interconnected by constraints). You can change cloth parameters like distance constraint compliance or compression to change how nearby particles react to it.
yes, that was my problem. when i moving a particle, all other particles move too and it make my slime look weird. i'll try other way to solve it, i known that is my issues. thank you!
Posts: 6,309
Threads: 24
Joined: Jun 2017
Reputation:
399
Obi Owner:
(01-04-2021, 03:27 AM)akayashi1212 Wrote: yes, that was my problem. when i moving a particle, all other particles move too and it make my slime look weird. i'll try other way to solve it, i known that is my issues. thank you!
You can completely disable distance and bend constraints (either in the cloth, or the entire solver). That will allow particles to move independently of each other.
You could also try leaving these constraints enabled, but increasing their compliance/max compression/max bending.
let me know how it goes. cheers!
Posts: 7
Threads: 0
Joined: Feb 2021
Reputation:
0
01-04-2021, 09:57 AM
(This post was last modified: 02-04-2021, 03:36 AM by akayashi1212.)
(01-04-2021, 08:40 AM)josemendez Wrote: You can completely disable distance and bend constraints (either in the cloth, or the entire solver). That will allow particles to move independently of each other.
I got it, now i can moving the particles independently like you said. My code:
Code: private void FixedUpdate()
{
if (Input.GetMouseButton(0))
{
Ray ray = cam.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit, Mathf.Infinity, LayerSlime))
{
for (int i = 0; i < solver.positions.count; ++i)
{
if (Vector3.Distance(hit.point, solver.positions[i]) <= Radial)
{
solver.positions[i] += moveParticle(hit.point, solver.positions[i]); // move around with X and Z axis
//solver.positions[i] += new Vector4(0, -1f, 0, 0) * Radial / 10f; // move down with Y axis
}
}
}
}
}
Vector4 moveParticle(Vector4 center,Vector4 particle)
{
return (particle - center).normalized * Radial / 10f;
}
Then, the cloth (my slime) doesn't reforming. I must reform it manually by my code (move the particles to the old position) or have any idea?
My setting:
https://drive.google.com/file/d/1pAX0U23...sp=sharing
https://drive.google.com/file/d/1GCe2xA6...sp=sharing
How it goes when move around (X and Z axis):
https://drive.google.com/file/d/14qEC0Ou...sp=sharing
How it goes when move down (Y axis):
https://drive.google.com/file/d/1YOZKWsL...sp=sharing
sorry, i don't know insert picture
thank you!
Posts: 6,309
Threads: 24
Joined: Jun 2017
Reputation:
399
Obi Owner:
05-04-2021, 12:06 PM
(This post was last modified: 05-04-2021, 12:06 PM by josemendez.)
If you want the cloth to "reform" or go back to its original shape, don't completely disable distance constraints. Instead, tweak their parameters (compliance, max compression, stretch) until you're happy with its behavior. See:
http://obi.virtualmethodstudio.com/tutor...aints.html
Posts: 7
Threads: 0
Joined: Feb 2021
Reputation:
0
(05-04-2021, 12:06 PM)josemendez Wrote: If you want the cloth to "reform" or go back to its original shape, don't completely disable distance constraints. Instead, tweak their parameters (compliance, max compression, stretch) until you're happy with its behavior. See:
http://obi.virtualmethodstudio.com/tutor...aints.html
Thank you! i'd try some way
|