21-12-2021, 02:15 PM
(21-12-2021, 08:11 AM)josemendez Wrote: 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.
Also 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.
Thanks for your answer!
The actual behaviour I want to achieve is firstly hook an object on the rope and then move it back and forth while it's on rope.
Now I am thinking about attachment process. If I use GetSectionAt, I will need to pass mu to get the position, but it could be attached somewhere in the middle of the rope, so how mu can be calculated, or maybe there's another way of doing this all?