Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Freeze softbody in certain axis
#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


Messages In This Thread
Freeze softbody in certain axis - by jaysama - 04-04-2022, 11:00 AM
RE: Freeze softbody in certain axis - by jaysama - 05-04-2022, 09:25 AM
RE: Freeze softbody in certain axis - by josemendez - 06-04-2022, 07:54 AM