12-05-2021, 07:43 AM
(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.