06-04-2022, 07:54 AM
(This post was last modified: 06-04-2022, 07:55 AM by josemendez.)
(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?