Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Freeze softbody in certain axis
#1
Hi Obi devs,

I want to have my softbody to fall to the ground with a fixed position, yet it moved a bit on X and Z axis.
Is there a way to freeze a softbody position in certain axis (X and Z) like in Unity's rigidbody setting?

Also how can I make all the softbodies to not interact with each other?
I figured out that I can use 1 solver for 1 softbody, but it'll bloat my scene with solvers, so is there any other way?

Thanks in advance!
Reply
#2
(04-04-2022, 11:00 AM)jaysama Wrote: I want to have my softbody to fall to the ground with a fixed position, yet it moved a bit on X and Z axis.
Is there a way to freeze a softbody position in certain axis (X and Z) like in Unity's rigidbody setting?

Hi!

Yes, you can change any per-particle property using the provided API:
http://obi.virtualmethodstudio.com/manua...icles.html

So you can project each particle position so that it doesn't move in a specific axis, or even stay on an arbitrary non-axis aligned plane, whatever you want.

(04-04-2022, 11:00 AM)jaysama Wrote: Also how can I make all the softbodies to not interact with each other?
I figured out that I can use 1 solver for 1 softbody, but it'll bloat my scene with solvers, so is there any other way?

As far as you use one solver per softbody but the same updater for all those solvers, that's fine performance-wise. If you use separate updaters, all softbodies will be updated sequentially and will not make use of multithreading, which will of course result in worse performance.

If you want an alternative to using separate solvers, you can filter out collisions between softbodies using collision filters. See:
http://obi.virtualmethodstudio.com/manua...sions.html
Reply
#3
Hi Jose,

Can you tell me more about constraining axis by modifying particle properties?
I have tried changing the velocity, angular velocity, even the position of each particles to starting value on every LateUpdate but the softbody still moved a bit upon touching the ground

Below is the image of my softbody
I need it to perfectly fit it inside the hole, but instead I see some gaps because it moved a bit

   
Reply
#4
(05-04-2022, 09:25 AM)jaysama Wrote: Can you tell me more about constraining axis by modifying particle properties?
I have tried changing the velocity, angular velocity, even the position of each particles to starting value on every LateUpdate but the softbody still moved a bit upon touching the ground

Hi,

If you've set the positions correctly, there's no way they can possibly deviate from their starting position: you're forcing them to have a certain value in the X and Z axis at the end of each frame.

There's not much to it, something along these lines should work (assuming you've stored starting positions in the startingPos array):

Code:
for (int i = 0; i < actor.solverIndices.Length; ++i)
{
    int index = actor.solverIndices[i];

    var pos = actor.solver.positions[index];
    pos.x = startingPos[index].x;
    pos.z = startingPos[index].z;
    actor.solver.positions[index] = pos;
}

Would it be possible for you to share the code you've written to do this?
Reply