03-06-2020, 08:18 PM
(This post was last modified: 03-06-2020, 09:46 PM by relevantname.)
(03-06-2020, 04:48 PM)josemendez Wrote: Hi there,
This is easy to achieve. Simply use a rope with enough resolution, and crank up distance and collision iterations quite high. That's pretty much it. Having a ObiParticleRenderer component on the rope is useful to visualize and debug particles. Let me know if you have issues with this.
Hi, I'm glad to hear that could be done using Obi Rope Thank you for your reply.
I did the settings that you suggest. If I'm not increase the lenght of the rope the particles are seperated from each other. Is there any automatic way to tell the renderer if particles are seperated more than a value, add new particles to the rope, or am I need to figure it out by myself?
Edit: After struggle a little more, I figured it out I can get the total lenght of the rope by using CalculateLength method. But I can't figured it out how to properly add or remove particles using this value.
So far, I did it like this but it is not consistent especially when going back.
Code:
private void Update()
{
_totalMovementDistance = _obiRope.CalculateLength();
if (_totalMovementDistance > _lastTotalMovementDistance)
{
_obiRopeCursor.ChangeLength(_obiRope.RestLength + 1f * Time.deltaTime);
_lastTotalMovementDistance = _totalMovementDistance;
}
else if (_totalMovementDistance < _lastTotalMovementDistance && _totalMovementDistance >= _initialLength)
{
_obiRopeCursor.ChangeLength(_obiRope.RestLength - 1f * Time.deltaTime);
_lastTotalMovementDistance = _totalMovementDistance;
}
}