(21-09-2026, 07:24 AM)josemendez Wrote: You can use the particles API. It allows you to read/write any per-particle properties, including positions. It's just a for loop:I just tested out saving ropes with this approach and seems to be working fine so far using the OnBlueprintLoaded event for restore timing. Thanks. I'm not doing any tear/resize. I did also have to save/restore the rigidbody GameObject state that I had attached at the end in my case. But it plugged into my existing persistence architecture pretty seamlessly. I thought this was going to be the hard part, but I struggled less with this than some of the other things I'm trying to do.
Code:for (int i = 0; i < actor.solverIndices.count; ++i)
{
int index = actor.solverIndices[i];
var position = actor.solver.positions[index]; // read position
actor.solver.positions[index] = position; // write position
}
If you have ropes that move around and simply want to restore their position/shape at a given point in time, this is enough.
Note however that merely saving/loading particle positions won't be enough if your ropes can be torn/cut/resized dynamically at runtime, since the amount of particles, particle indices and their constraint connectivity changes. If the rope has pooled particles, you may or may not want to save the pool of inactive particles as well. Also note that things like cursors, attachments, or element state won't be saved along with particle positions, you may or may not need to save these. All these details can considerably complicate saving/loading (the "full state" save described by Skotty above).
|
Help Rope Save Load
|
|
|
|
« Next Oldest | Next Newest »
|
| Messages In This Thread |
|
Rope Save Load - by mechabit - 20-09-2026, 01:24 PM
RE: Rope Save Load - by Skotty - 20-09-2026, 04:47 PM
RE: Rope Save Load - by josemendez - 21-09-2026, 07:24 AM
RE: Rope Save Load - by mechabit - 21-09-2026, 08:17 AM
RE: Rope Save Load - by josemendez - 21-09-2026, 09:32 AM
RE: Rope Save Load - by Skotty - 22-09-2026, 06:39 AM
RE: Rope Save Load - by mechabit - 21-09-2026, 01:09 PM
RE: Rope Save Load - by josemendez - 21-09-2026, 04:11 PM
RE: Rope Save Load - by mechabit - 21-09-2026, 05:35 PM
RE: Rope Save Load - by mechabit - 22-09-2026, 07:11 AM
RE: Rope Save Load - by josemendez - 22-09-2026, 07:36 AM
|
