Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Rope saving and restore by Json
#7
(25-06-2024, 09:31 AM)tapLucas Wrote: generate the simplest rope and fix the start and end points of the rope, because the two ends of the rope need to be fixed according to the Obi attachment, so that the rope can be dragged and move. Then I restore the data from JSON and set it to the particle, theoretically, these are two different ropes, so the data is also different.

You're creating a straight rope between two points. However since it's a lot shorter than the original rope, it has less particles and less constraints: this can't possibly work.

You're creating a blueprint using just the start/end points, so you must be somehow storing/serializing the start and end points as well, correct?

If so, you should store all control points in the blueprint (not just the first and the last): at least their position, thickness, and tangent vectors. You'll also need to store the blueprint's resolution, as it determines the amount of particles created per distance unit.
This data determines the overall shape of the rope and the amount of particles/constraints used to create it. Then you'll be able to set the particle positions of the original rope, as you know both ropes have been created from the same blueprint and have the same data.

(25-06-2024, 09:31 AM)tapLucas Wrote: Regarding blueprints, from my code, you can see that I dynamically create blueprints at runtime, from my view, it just like a runtime particles container.

Blueprints store particle data, true. But they create this data based on a description of the object being created, in the case of ropes, a path defined by control points. If you use different control points, the amount of data and the values they store is different.

(25-06-2024, 09:31 AM)tapLucas Wrote: And if I need to restore, when should the timing be?

Anytime. First, create your blueprint from the data stored in the JSON. After the blueprint has been loaded, then set particle positions.

kind regards,
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 josemendez - 25-06-2024, 09:41 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