Obi Official Forum
Modify parameters of shape matching constraints - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Softbody (https://obi.virtualmethodstudio.com/forum/forum-12.html)
+--- Thread: Modify parameters of shape matching constraints (/thread-2832.html)



Modify parameters of shape matching constraints - fewerhy - 29-03-2021

I would like to know whether it is possible to modify the parameters of shape matching constraint for a softbody during runtime. For example, if I want to change the goal position for each particle.


RE: Modify parameters of shape matching constraints - josemendez - 29-03-2021

(29-03-2021, 05:01 AM)fewerhy Wrote: I would like to know whether it is possible to modify the parameters of shape matching constraint for a softbody during runtime. For example, if I want to change the goal position for each particle.

"Goal position" is not a parameter of shape matching. This is calculated at runtime as center of mass of the current cluster at rest, you can't change it (except by tinkering with particle masses, as that will move the center of mass around).

All exposed parameters can be changed at runtime, though:

Code:
softbody.shapeMatchingConstraintsEnabled = <value>;
softbody.deformationResistance = <value>;
softbody.maxDeformation = <value>;
softbody.plasticCreep = <value>;
softbody.plasticRecovery= <value>;
softbody.plasticYield = <value>;



RE: Modify parameters of shape matching constraints - fewerhy - 29-03-2021

(29-03-2021, 10:07 AM)josemendez Wrote: "Goal position" is not a parameter of shape matching. This is calculated at runtime as center of mass of the current cluster at rest, you can't change it (except by tinkering with particle masses, as that will move the center of mass around).

All exposed parameters can be changed at runtime, though:

Code:
softbody.shapeMatchingConstraintsEnabled = <value>;
softbody.deformationResistance = <value>;
softbody.maxDeformation = <value>;
softbody.plasticCreep = <value>;
softbody.plasticRecovery= <value>;
softbody.plasticYield = <value>;

Thanks for quick reply.
 
 
I have uploaded a figure to here ( https://ibb.co/Pj7Z0P7 ). It shows you the goal position of a particle. You are right, it is not a parameter, and it calculated by rest center, current center and the rotation. Can I modify those variables, or they just read only?
 
I have also tried to read the “coms” and “restcoms” from the shape matching constraint of a softbody, but the value of some “coms” and “restcoms” are extremely large, which seems not correct.  


RE: Modify parameters of shape matching constraints - josemendez - 29-03-2021

(29-03-2021, 01:24 PM)fewerhy Wrote: Thanks for quick reply.
 
 
I have uploaded a figure to here ( https://ibb.co/Pj7Z0P7 ). It shows you the goal position of a particle. You are right, it is not a parameter, and it calculated by rest center, current center and the rotation. Can I modify those variables, or they just read only?
 
I have also tried to read the “coms” and “restcoms” from the shape matching constraint of a softbody, but the value of some “coms” and “restcoms” are extremely large, which seems not correct.  

One shape matching cluster is generated per particle, so the cluster’s current center and rotation are the  particle’s position and rotation. You can both read and write these using the particle API:
http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html

The coms are expressed in solver space, so depending on where your particles are in relation to the solver their values can be really large, it’s totally fine.

Btw, Obi does not use “vanilla” shape matching, as it’s unstable for certain particle configurations. It extends it by using particle orientations: http://matthias-mueller-fischer.ch/publications/orientedParticles.pdf