Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Rope saving and restore by Json
#14
(27-06-2024, 12:22 PM)josemendez Wrote: This will only happen if your ropes have had their length changed at runtime using a cursor, or if they have been cut. Otherwise order should be contiguous. If you're not doing either, then it means you're either storing or loading particles in the wrong order.
I apologize for disturbing you again. Previously, following your guidance, I saved and restored the control points, and initially achieved the recovery of the rope's shape. As the functionality has been developed over time, I've found that to be an illusion; only simple entanglement shapes can be recovered, and all slightly complex ones cannot be recovered.

Here are the complete steps I have taken with the rope:

1.Using an algorithm to directly generate entanglement points between the starting and ending points of the rope, and making multiple ropes entangle with each other. The starting point, endpoint, and entanglement points are added to the control points in order, then the rope is instantiated.
2.After the instantiation of the rope in the previous step, it may be because there are too many control points, at this point, the instantiated ropes are very long and bunched up, but it can be seen that there are effective entanglement points between the ropes. So I further contracted these ropes until they became tight. Due to the physical pull caused by entanglement between the ropes, these pull points mostly occur in the middle part of the ropes, so I set both cursorMu and SourceMu to 0.1, making the ropes as unaffected by the entanglement points as possible during the contraction.
3.After all the above ropes are completely generated and stationary, I stored all the necessary information of the ropes into JSON (we have discussed the details before). When starting a new level, read the data from JSON and restore the ropes.
As you said, changing the length of the rope during runtime may lead to an error in the order of particles, but now I can't avoid this operation unless I can find a suitable generation method so that the ropes generated in step 2 are just the right length.

Since your last suggestion, I have also tried the following:

1. I found that the order of rope.elements is continuous, so I tried to store this and restore it to solver.positions[particlesIndices[i]], but it did not work.
2. I tried to store the index of rope.solverIndices and the corresponding solver.positions[particlesIndices[i]] and restore them, but it did not work.

I don't have any other ways now.

I am an independent developer, and the rope gameplay can be said to be the core part, and most of the game is centered around the rope. If the loading of the rope is always not figured out, there is no need to do other game content. In the past two or three months, I have spent a lot of time on the debugging of the rope's physical properties and operational feel, as well as the writing of the code. I don't want to give up yet, and I don't want to waste this part of the time in vain. Perhaps you can give me some more ideas, really thank you very much.
Reply


Messages In This Thread
Rope saving and restore by Json - by tapLucas - 22-06-2024, 03:32 PM
RE: Rope saving and restore by Json - by tapLucas - 22-06-2024, 06:37 PM
RE: Rope saving and restore by Json - by tapLucas - 25-06-2024, 09:02 AM
RE: Rope saving and restore by Json - by tapLucas - 25-06-2024, 09:31 AM
RE: Rope saving and restore by Json - by tapLucas - 25-06-2024, 09:55 AM
RE: Rope saving and restore by Json - by tapLucas - 25-06-2024, 10:26 AM
RE: Rope saving and restore by Json - by tapLucas - 27-06-2024, 11:54 AM
RE: Rope saving and restore by Json - by tapLucas - 27-06-2024, 12:59 PM
RE: Rope saving and restore by Json - by tapLucas - 11-07-2024, 07:21 AM
RE: Rope saving and restore by Json - by tapLucas - 17-08-2024, 09:02 AM
RE: Rope saving and restore by Json - by tapLucas - 17-08-2024, 10:37 AM
RE: Rope saving and restore by Json - by tapLucas - 17-08-2024, 11:10 AM