Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lock Softbody Movement & Cut it
#8
(27-05-2020, 10:59 AM)arrnav96 Wrote: Hmm, in that case I have an idea. What if I keep all particles initially locked as slime spawns, then check which particle the knife collider touches as knife is moved, then unlock (remove from locking group) only that particle which is touched by knife collider? Is there a way to detect particle indice based on a box collider collision? 

I have tried the locking now and it works, but then the softbody behaviour is completely gone as the slime particles no longer react to knife touch on it.

The desired behavior is the slime should stay in air, while still being "pressed" visually by the knife before the cut.

Yes, you can get the particle indices involved in collisions. See:
http://obi.virtualmethodstudio.com/tutor...sions.html

From what you describe, full locking of particles won't actually solve your problem. A locked particle ceases to react to all dynamics (nor forces, no gravity, no wind, nothing) it is fully immovable.

If you want the softbody to deform due to external forces, but keep these forces from moving it away from a location (without any part of it being actually attached to something), you're going to need to get clever about it:

The center of mass of a deformable object can usually be regarded as its "center", for most purposes. You could calculate the center of mass each frame (there's a snippet that does this here: http://obi.virtualmethodstudio.com/tutor...icles.html), calculate how much it has moved since the last frame, then translate all particles back by the same amount. If my intuition is right, this will have the effect of keeping the center of mass of the object "locked" in the same place, while keeping particles free.

An alternate, easier solution if you can manage it, is to just calculate the center of mass and then keep the camera pointing at it. If there's no background or the background moves together with the camera, it would look as if the softbody was not moving at all.
Reply


Messages In This Thread
Lock Softbody Movement & Cut it - by arrnav96 - 27-05-2020, 06:42 AM
RE: Lock Softbody Movement & Cut it - by arrnav96 - 27-05-2020, 09:51 AM
RE: Lock Softbody Movement & Cut it - by arrnav96 - 27-05-2020, 10:39 AM
RE: Lock Softbody Movement & Cut it - by arrnav96 - 27-05-2020, 10:59 AM
RE: Lock Softbody Movement & Cut it - by josemendez - 27-05-2020, 11:13 AM
RE: Lock Softbody Movement & Cut it - by arrnav96 - 27-05-2020, 01:20 PM
RE: Lock Softbody Movement & Cut it - by arrnav96 - 01-06-2020, 10:36 AM
RE: Lock Softbody Movement & Cut it - by arrnav96 - 01-06-2020, 12:24 PM