Obi Official Forum
Help move the ring along the rope - 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 move the ring along the rope (/thread-2923.html)



move the ring along the rope - xkalibrx - 12-05-2021

Please help to determine the rotation of the ring, which is worn on the rope, based on the current point. I want to make sure that when you put the ring on the rope, it smoothly slides along it. A simple physical ring often gets stuck because the rope is constantly in motion.

I want to try setting the exact Z rotation of the ring at its current location so that it just glides along the rope to give it strength.


RE: move the ring along the rope - josemendez - 12-05-2021

(12-05-2021, 05:40 AM)xkalibrx Wrote: Please help to determine the rotation of the ring, which is worn on the rope, based on the current point. I want to make sure that when you put the ring on the rope, it smoothly slides along it. A simple physical ring often gets stuck because the rope is constantly in motion.

I want to try setting the exact Z rotation of the ring at its current location so that it just glides along the rope to give it strength.

You can use:

Code:
var section = rope.GetComponent<ObiPathSmoother>().GetSectionAt(float mu);

GetSectionAt() takes a normalized coordinate as input (a float from 0 to 1, 0 being the start of the rope and 1 being the end) and returns a struct containing position, normal, tangent and bitangent (a full orthonormal frame) of the rope at that point.

See the utility script /Obi/Scripts/RopeAndRod/Utils/ObiRopeAttach.cs for an example of how to use it to place an object along the rope.