Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Obi Rope Lenght Problem
#1
Hi, 

I can't increase my rope's lenght after certain point. Is there a restriction for that?

Thanks.

Edit: I tried to increase Pooled Particles, no luck.
Reply
#2
(15-04-2020, 11:57 AM)relevantname Wrote: Hi, 

I can't increase my rope's lenght after certain point. Is there a restriction for that?

Thanks.

Yes. Ropes have a particle pool from which they take particles to increase their lenght or be torn. Once all particles in the pool have been used up you can no longer extend the rope. This is done to avoid runtime memory allocations.

You can change the size of the pool in the rope's blueprint. See:
http://obi.virtualmethodstudio.com/tutor...setup.html

Quote:Pooled particles:
(Ropes only). Extra particles allocated to be used when tearing or resizing the rope. You can set this value to zero if you do not plan on tearing or resizing the rope at runtime, as no extra particles besides the initial ones will be needed.
Reply
#3
(15-04-2020, 12:00 PM)josemendez Wrote: Yes. Ropes have a particle pool from which they take particles to increase their lenght or be torn. Once all particles in the pool have been used up you can no longer extend the rope. This is done to avoid runtime memory allocations.

You can change the size of the pool in the rope's blueprint. See:
http://obi.virtualmethodstudio.com/tutor...setup.html

I tried to increase it, but no effect at all. Btw, I increase the lenght of the rope to some object's position, then pin the last particle to some object. It works but when the object is pinned to the rope, the rope strectches like rubber. How can I prevent that? 

And my other question is; under what conditions should I change the mass of the rope(or should I change?)?
Reply
#4
(15-04-2020, 12:31 PM)relevantname Wrote: I tried to increase it, but no effect at all. Btw, I increase the lenght of the rope to some object's position, then pin the last particle to some object. It works but when the object is pinned to the rope, the rope strectches like rubber. How can I prevent that? 

And my other question is; under what conditions should I change the mass of the rope(or should I change?)?
Hi,

It should have an effect. Are you using your own script to change the length of the rope? how does it look like?

Stretching is due to slow convergence, can be caused by insufficient constraint iterations and/or too large timestep (like in most physics engines). This is specially noticeable if the mass of the object attached to the rope is very large compared to the rope's mass.

So increase the amount of distance constraint iterations, and/or the amount of updater substeps. For more into on iterations/substeps and convergence, see:
http://obi.virtualmethodstudio.com/tutor...gence.html

You should change the mass if you feel like you need a heavier/lighter rope. It's up to you. Keep in mind that large mass ratios (very light/very heavy objects interacting together) slow down convergence, requiring to spend more resources to keep high quality results (iterations/substeps).
Reply
#5
(15-04-2020, 12:39 PM)josemendez Wrote: Hi,

It should have an effect. Are you using your own script to change the length of the rope? how does it look like?

Stretching is due to slow convergence, can be caused by insufficient constraint iterations and/or too large timestep (like in most physics engines). This is specially noticeable if the mass of the object attached to the rope is very large compared to the rope's mass.

So increase the amount of distance constraint iterations, and/or the amount of updater substeps. For more into on iterations/substeps and convergence, see:
http://obi.virtualmethodstudio.com/tutor...gence.html

You should change the mass if you feel like you need a heavier/lighter rope. It's up to you. Keep in mind that large mass ratios (very light/very heavy objects interacting together) slow down convergence, requiring to spend more resources to keep high quality results (iterations/substeps).

Hi, first of all thank you for your help. I solved the lenght problem. I have other questions in my mind though;

- Is there any difference between Handles and Pin Constraints?
- When I change the particle mass, the particles created in runtime are also have the same mass amount, right?

My code is;

Code:
_rope.RemoveFromSolver(null);
       
       Quaternion lookRot =
           Quaternion.LookRotation(_rope.transform.position - GameManager.Instance.Ball.transform.position, -Vector3.forward);
       lookRot.x = 0.0f;
       lookRot.y = 0.0f;
       _rope.transform.rotation = lookRot;

       _ropeRenderer.enabled = true;

       Vector3 lastParticlePos = _rope.GetParticlePosition(_rope.UsedParticles - 1);
       float distanceToBallFromHandle = Vector3.Distance(GameManager.Instance.Ball.transform.position, lastParticlePos) + _rope.CalculateLength();

       float attachSpeed = GameManager.Instance.handleAttachSpeed;

       _rope.AddToSolver(null);
       while (_rope.CalculateLength() < distanceToBallFromHandle)
       {
           _ropeCursor.ChangeLength(_rope.RestLength + attachSpeed * Time.deltaTime);
           yield return null;
       }

       _ropePinConstraints.RemoveFromSolver(null);
       ObiPinConstraintBatch pinConstraintsBatch = _rope.PinConstraints.GetFirstBatch();
       ObiDistanceConstraintBatch distanceContraintsBatch = _rope.DistanceConstraints.GetFirstBatch();
       pinConstraintsBatch.AddConstraint(distanceContraintsBatch.springIndices[distanceContraintsBatch.springIndices.Count-1], GameManager.Instance.Ball.GetComponentInChildren<ObiColliderBase>(), Vector3.zero,
           Quaternion.identity, 0);
       
       _ropePinConstraints.AddToSolver(null);
       _rope.AddToSolver(null);


Thanks again.
Reply
#6
(15-04-2020, 12:46 PM)relevantname Wrote: - Is there any difference between Handles and Pin Constraints?

Handles were replaced by Attachments in 5.0. I you mean if Attachments are the same as pin constraints, not exactly.

Attachments can be static or dynamic. Static attachments are implemented using fixed particles (particles with their inverseMass set to 0). Dynamic attachments are implemented using pin constraints.

From the pin constraints manual page:
http://obi.virtualmethodstudio.com/tutor...aints.html

Quote:Unlike most other constraints, pin constraints aren't stored in a blueprint. They are automatically created and managed by dynamic particle attachments.

And from the attachments page:
http://obi.virtualmethodstudio.com/tutor...ments.html

Quote:Internally, dynamic attachments use pin constraints. Read the pin constraints section for more info on pin constraints.

(15-04-2020, 12:46 PM)relevantname Wrote: - When I change the particle mass, the particles created in runtime are also have the same mass amount, right?

Yes, that's the whole point of blueprints. When you instantiate a blueprint, the runtime particle properties are copied from the blueprint values.
Reply
#7
(15-04-2020, 01:00 PM)josemendez Wrote: Handles were replaced by Attachments in 5.0. I you mean if Attachments are the same as pin constraints, not exactly.

Attachments can be static or dynamic. Static attachments are implemented using fixed particles (particles with their inverseMass set to 0). Dynamic attachments are implemented using pin constraints.

From the pin constraints manual page:
http://obi.virtualmethodstudio.com/tutor...aints.html


And from the attachments page:
http://obi.virtualmethodstudio.com/tutor...ments.html



Yes, that's the whole point of blueprints.  When you instantiate a blueprint, the runtime particle properties are copied from the blueprint values.

I'm using Obi Rope 4.1 btw. I should've inform you in first place. Sorry for that :/
Reply
#8
(15-04-2020, 01:13 PM)relevantname Wrote: I'm using Obi Rope 4.1 btw. I should've inform you in first place. Sorry for that :/

No worries! In that case, Handles are equivalent to 5.X's static attachments. Pin constraints are equivalent to 5.X's dynamic attachments.

The difference lies in that handles won't apply forces to any object they're on. Pin constraints however will. So if you require to suspend an rigidbody from a rope, you should use pin constraints.
Reply
#9
(15-04-2020, 01:16 PM)josemendez Wrote: No worries! In that case, Handles are equivalent to 5.X's static attachments. Pin constraints are equivalent to 5.X's dynamic attachments.

The difference lies in that handles won't apply forces to any object they're on. Pin constraints however will. So if you require to suspend an rigidbody from a rope, you should use pin constraints.

Hmm, I should use pin constrains in my case. Thanks again Sonrisa

I'm after a behaviour like your grappling hook example, but without creating the rope on runtime. I want to click an object, the rope's lenght extents to that location then attached to this object. And I want my rope's stretching value is very low like spider web in spider man Gran sonrisa
Reply