Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lock Softbody Movement & Cut it
#9
(27-05-2020, 11:13 AM)josemendez Wrote: 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.

I'll try this now, but adding that COM code snippet, at the "if (actor == null || !actor.InSolver)" line of that code under OnDrawGizmos() I get this error inside Unity -

"ObiActor' does not contain a definition for 'InSolver' and no accessible extension method 'InSolver' accepting a first argument of type 'ObiActor' could be found (are you missing a using directive or an assembly reference?)"

Now I know for a fact that InSolver is defined in the API under ObiActor class, then why is Unity throwing me this error suddenly? (Mind you, things have been imported correctly and no prior errors in Obi Scenes)
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 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