![]() |
Help Adding pin constraints to a rope at runtime - 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 Adding pin constraints to a rope at runtime (/thread-487.html) Pages:
1
2
|
RE: Adding pin constraints to a rope at runtime - josemendez - 18-03-2018 (18-03-2018, 06:44 PM)Gieve Wrote: fantastic!!! for those interested I added another call to a coroutine call DoLast that had a while(!generated) loop with a waitforseconds call of 0.1 second, when the rope set up coroutine finishes it sets the flag to true, then it set up the pin. Hi, No need to do it in such a complicated way, you can simply wait for MoveNext to finish like this: Code: yield return ropemaker.MakeRope(); or, if you don't want to call MakeRope inside a coroutine or use yield, you can just advance the coroutine yourself until it is done: Code: IEnumerator coroutine = ropemaker.MakeRope(); To set the rope particle's mass, set their inverse mass (1/mass). Inverse masses are used because it is much more efficient in terms of performance, and because it avoids division by zero issues. See: http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html |