Help Cloth does not simulate when unfixed during runtime. - 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 does not simulate when unfixed during runtime. (/thread-1410.html) |
Cloth does not simulate when unfixed during runtime. - 3rdcat - 07-10-2019 Hi, I'm trying to experiment with unfixing cloth during runtime. I'm using a raycast to trigger the unfixing, however when the cloth is hit, the particles do become unfixed but the cloth does not respond to gravity/wind/anything. Attached is the script I am using to test it. Stuff in comments was me trying to force active on the particles just to see if it would do anything (it didn't unfortunately). Please do help assist. [attachment=427] Thank you very much. RE: Cloth does not simulate when unfixed during runtime. - josemendez - 07-10-2019 (07-10-2019, 08:15 AM)3rdcat Wrote: Hi, I'm trying to experiment with unfixing cloth during runtime. Hi there, You're just changing the actor's data (which is the data serialized with the actor, copied over to the solver when you press "play"), but not solver data. While you can read data from actor.invMasses/positions/velocities/whatever to retrieve rest-pose values, writing to them does not have any effect at runtime. You need to set solver.invMasses instead. Also no need to call UpdateActiveParticles(), as you're not activating/deactivating particles, just setting their mass. Take a look at: http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html RE: Cloth does not simulate when unfixed during runtime. - 3rdcat - 07-10-2019 (07-10-2019, 09:23 AM)josemendez Wrote: Hi there, Thank you very much Jose! After changing it to solver.invMasses, it is working well. May I know if it is possible to know the position of particles in the index, or some other way of selection, so as to choose some particles to be left fixed? |