Obi Official Forum
Help Loading rope state after changing it's length - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: Help Loading rope state after changing it's length (/thread-3876.html)



Loading rope state after changing it's length - natko1412 - 19-05-2023

Hi again,

this thread is a continuation this one.

I am trying to load rope state after changing it's length in the previous run.
My workflow is as follows:

Saving:
1. Serialize position/orientation for each object I need
2. Serialize rope length changes throughout the run
3. Serialize particle positions and velocities

Loading:
1. Deserialize and set position/orientation for each object I need
2. Change rope for each entry in my serialized rope lengths field (got it from the post here)
3. Deserialize and set particle positions and velocities


The problem I encounter is that after initial position is correctly set, attachment particles jump to other position, and my attachment ends up with a big gap.
Here is the video:
https://streamable.com/4q8ib4

The particles seem to bee still attached, but attachment point should be as shown on this image:
https://ibb.co/2jbT9y2

Do you have any idea how to solve this?

Best regards


RE: Loading rope state after changing it's length - josemendez - 19-05-2023

Hi!

Attachments don't automatically change the position of either the rope or the object it's attached to (as that would result in a heap of problems in the general case), they attach at the position relative to the object that the rope's particle group is in at the time of creating the attachment. See:

http://obi.virtualmethodstudio.com/manual/6.3/attachments.html

Quote:It's important to realize that attachments do not move the particle group to the position of the target object, nor the target object to the position of the particle group. Moving the particle group to the target's position would collapse all particles into a single point, and would result in a kickback effect once the particles spring back to their original positions. Moving the target could cause a whole palette of issues depending on your game logic.

Instead, particles in the group are attached at their current position relative to the target object. This makes it simple to work with multiple particles, and ensures smooth attachments with no initial "jumps" or sudden motions.

If you want particles attached at a specific position other than their position at the time of creating the attachment, you can set their position at runtime before creating the attachment: see scripting particles.



RE: Loading rope state after changing it's length - natko1412 - 19-05-2023

(19-05-2023, 11:03 AM)josemendez Wrote: Hi!

Attachments don't automatically change the position of either the rope or the object it's attached to (as that would result in a heap of problems in the general case), they attach at the position relative to the object that the rope's particle group is in at the time of creating the attachment. See:

http://obi.virtualmethodstudio.com/manual/6.3/attachments.html


Okay, so I should disregard the attachment from the original blueprint and create a new attachment after setting the particle positions?


Edit. I got it working! Thank you Jose, you are very kind! I remember reading that about attachments in docs before but I obviously forgot about it.