Obi Official Forum
How to fallow 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: How to fallow rope (/thread-2723.html)



How to fallow rope - eisen - 25-01-2021

When i press play i want my charachter follow the rope start to end. How can i follow with code ?

Do i need to get particle positions ? if so how can i reach particle positions from code ? or are there any alternative way ?


RE: How to fallow rope - josemendez - 26-01-2021

Simplest way to get a position/orientation along a rope is to use:

Code:
var frame = rope.GetComponent<ObiPathSmoother>().GetSectionAt(value);

You pass a normalized length value as parameter (0 for the start of the rope, 1 for the end, or any value in between) and you get a ObiPathFrame struct that contains position, orientation, color, thickness, and an orthonormal frame (normal, binormal, tangent) at that particular point in the rope.

There's a utility script included that you can try: "ObiRopeAttach". It uses this method to just move an object to a point along the rope.

You can also use raw particle positions if you want, see:
http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html