Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Cloth does not simulate when unfixed during runtime.
#1
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.

   

Thank you very much.
Reply
#2
(07-10-2019, 08:15 AM)3rdcat Wrote: 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.



Thank you very much.

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/tutor...icles.html
Reply
#3
(07-10-2019, 09:23 AM)josemendez Wrote: 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/tutor...icles.html

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?
Reply