23-02-2023, 11:43 AM
(This post was last modified: 23-02-2023, 11:48 AM by josemendez.)
(23-02-2023, 11:35 AM)rohit_dhak Wrote: I have a pool particle size of 1000.
Unity was just freezing whenever it would try to run the
Code:
set_control()
from the set_control() function, I removed the check condition
Code:
while (c1_len != c1_control_ip)
Unity froze in that while loop for an obvious reason: neither variable used as the condition to break the loop (c1_len and c1_control_ip) changes once inside the loop. So once execution enters the loop, it will never exit.
(23-02-2023, 11:35 AM)rohit_dhak Wrote: However it just set the rope length instantly and did not change it continuously over time from the current length.
Any idea on how to achieve that.
This is a basic programming question, not really related to Obi. If you want to increase a variable, you just add a value to it using the "+" operator.
Something like:
Code:
ropeLength = ropeLength + increment;
cursor.ChangeLength(ropeLength);
To make it frame rate independent, just multiply the increment by the time passed since the last frame:
Code:
ropeLength = ropeLength + increment * Time.deltaTime;
cursor.ChangeLength(ropeLength);
You have a working example of this in the included "Crane" sample scene.