24-05-2021, 08:27 AM
(This post was last modified: 24-05-2021, 08:29 AM by josemendez.)
(24-05-2021, 08:05 AM)pmike Wrote: Can you give a sample code for saving and loading the rope state using particles API?
There's sample code for this in the link I just posted. To read:
Code:
for (int i = 0; i < actor.solverIndices.Length; ++i)
{
int solverIndex = actor.solverIndices[i];
var pos = actor.solver.positions[solverIndex];
var vel = actor.solver.velocities[solverIndex];
}
To write:
Code:
for (int i = 0; i < actor.solverIndices.Length; ++i)
{
int solverIndex = actor.solverIndices[i];
actor.solver.positions[solverIndex] = yourPos;
actor.solver.velocities[solverIndex] = yourVel;
}