14-02-2019, 10:58 AM
(14-02-2019, 10:32 AM)Richard Wrote: [ -> ]I tried the other way, but it did not work like the image. What is wrong?
I read the page. How can I specify fixed particle and inverse mass values?
(14-02-2019, 10:32 AM)Richard Wrote: [ -> ]I tried the other way, but it did not work like the image. What is wrong?
(14-02-2019, 10:58 AM)Richard Wrote: [ -> ]I read the page. How can I specify fixed particle and inverse mass values?
int particleSolverIndex = actor.particleIndices[<your particle index here>];
solver.invMasses[particleSolverIndex] = <your value here>
(14-02-2019, 10:51 AM)josemendez Wrote: [ -> ]Hi,
What do you mean "the other way"?
Honestly I don't know what your use case is, but adding that many pin constraints for a dress just doesn't make sense to me. Why'd you want to do that? Pin constraints are used to enable two-way coupling with rigidbodies... looks like you'd want to use either fixed particles or skin constraints, if you're trying to create character clothing. Also having a mesh collider for a deformable object doesn't make sense, specially when Obi has built-in collision detection for cloth.
(14-02-2019, 11:04 AM)josemendez Wrote: [ -> ]Like it says in the page:
Code:int particleSolverIndex = actor.particleIndices[<your particle index here>];
solver.invMasses[particleSolverIndex] = <your value here>
Set it to 0 to fix a particle, set it to any positive value to unfix it.
(14-02-2019, 11:14 AM)Richard Wrote: [ -> ]You suggested two ways. One is to inverse particles, the other is pin constrains. I would like to use fixed particles. I tried to use the object as pinned to slot. If I do that, obi collision needs other collision such as box, cupsele, sphere, mesh. But it looks wrong.
(14-02-2019, 11:14 AM)Richard Wrote: [ -> ]You suggested two ways. One is to inverse particles, the other is pin constrains. I would like to use fixed particles. I tried to use the object as pinned to slot. If I do that, obi collision needs other collision such as box, cupsele, sphere, mesh. But it looks wrong.
Thank you for your time so much! , but how can I see particle index?
And the the any positive value affect the effect of result?
(14-02-2019, 11:25 AM)josemendez Wrote: [ -> ]the particle index runs from 0 (first particle in the actor) to the number of particles in the actor. So depending on which particle you want to fix/unfix, you have to use a different index. How to get it depends on what you need to do at runtime: do you pick particles with mouse, or in response to a collision? do you simply want to unfix all fixed particles?
The inverse mass is, as the name implies, 1/mass of the particle. So high inverse masses will cause the particle to be lighter. Low values will make it progressively heavier, until you reach 0 and the particle is infinitely heavy (fixed).
(14-02-2019, 11:37 AM)Richard Wrote: [ -> ]I would like to unfix all fixed particles.
float invMassPerParticle = 0.01f;
for (int i = 0; i < actor.invMasses.Length; ++i){
int indexInSolver = actor.particleIndices[i];
actor.invMasses[i] = solver.invMasses[indexInSolver] = invMassPerParticle;
}
(14-02-2019, 11:37 AM)Richard Wrote: [ -> ]I would like to unfix all fixed particles.
(14-02-2019, 12:20 PM)Richard Wrote: [ -> ]I want to make vending machine of clothing. When a clothing is displayed, it have to be fixed pose, but once it was bought by someone, it should be normal clothing. Can I do that by same object?
(14-02-2019, 12:28 PM)josemendez Wrote: [ -> ]It depends on how you want the cloth to behave when it is "fixed". Does it need to move around, or will it just be static (un-simulated) until someone purchases it?
(14-02-2019, 12:47 PM)Richard Wrote: [ -> ]I want it be static.
I tried code, but many errors happen.
"Assets\InverseParticles.cs(15,33): error CS0029: Cannot implicitly convert type 'string' to 'UnityEngine.GameObject'"
"Assets\InverseParticles.cs(18,40): error CS1061: 'GameObject' does not contain a definition for 'invMasses' and no accessible extension method 'invMasses' accepting a first argument of type 'GameObject' could be found (are you missing a using directive or an assembly reference?)"
"Assets\InverseParticles.cs(20,44): error CS1061: 'GameObject' does not contain a definition for 'particleIndices' and no accessible extension method 'particleIndices' accepting a first argument of type 'GameObject' could be found (are you missing a using directive or an assembly reference?)"
"Assets\InverseParticles.cs(21,24): error CS1061: 'GameObject' does not contain a definition for 'invMasses' and no accessible extension method 'invMasses' accepting a first argument of type 'GameObject' could be found (are you missing a using directive or an assembly reference?)"
"Assets\InverseParticles.cs(21,39): error CS0103: The name 'solver' does not exist in the current context"
I can't solve the problem. I thought "actor" in your code is to get name of object of mesh. However, string causes error.
In addition to that, I cannot what to do for "solver", or am I wrong how to think the problems?