02-04-2020, 11:48 AM
(This post was last modified: 02-04-2020, 11:52 AM by josemendez.)
If you set a particle position, it can move immediately after due to one of two things:
- The particle is part of an attachment. In that case, as soon as the attachment is updated it will set the particle position so that it doesn't violate the attachment.
- The new position you set violates a constraint. In that case, as soon as the solver is updated, it will set the position to the closest position that does not violate the constraint.
It does not make sense to set the position of an attached particle (you should set the position of whatever it is attached to instead, or set its position and immediately Bind() the attachment)
Setting the position of a single particle without setting all other particles accordingly will cause the solver to immediately modify it as a result of simulating constraints. For instance: if you set a single particle far away from the rest, the solver will immediately project all particles in the rope so that distance constraints are met and the rope keeps its length.
The only way to set a particle position and make sure it is not modified by the simulation is to set its inverse mass to zero, as explained in the docs:
http://obi.virtualmethodstudio.com/tutor...icles.html
Also, remember that all particle properties are expressed in solver space. So if you set positions, make sure to express them in solver space (meaning, the solver's local space).
- The particle is part of an attachment. In that case, as soon as the attachment is updated it will set the particle position so that it doesn't violate the attachment.
- The new position you set violates a constraint. In that case, as soon as the solver is updated, it will set the position to the closest position that does not violate the constraint.
It does not make sense to set the position of an attached particle (you should set the position of whatever it is attached to instead, or set its position and immediately Bind() the attachment)
Setting the position of a single particle without setting all other particles accordingly will cause the solver to immediately modify it as a result of simulating constraints. For instance: if you set a single particle far away from the rest, the solver will immediately project all particles in the rope so that distance constraints are met and the rope keeps its length.
The only way to set a particle position and make sure it is not modified by the simulation is to set its inverse mass to zero, as explained in the docs:
http://obi.virtualmethodstudio.com/tutor...icles.html
Code:
An inverse mass of 0 means the particle's mass is infinite, so its position will be unaffected by dynamics (allowing you to override it manually).
Also, remember that all particle properties are expressed in solver space. So if you set positions, make sure to express them in solver space (meaning, the solver's local space).