Posts: 27
Threads: 12
Joined: Mar 2020
Reputation:
0
Hi,
I wonder that, is obi rope can be used with creating a game like rope around. ( https://www.youtube.com/watch?v=eB0atpB4hNY)
I saw your video( https://www.youtube.com/watch?v=Czy6WnIWtyY) and I tried to do the same all day long but I failed miserably. So, I wanted to ask that if this can be done or it is really hard to achieve this sort of effect with obi rope.
P.S: I'm using ObiRope 4.
Posts: 6,309
Threads: 24
Joined: Jun 2017
Reputation:
399
Obi Owner:
03-06-2020, 04:48 PM
(This post was last modified: 03-06-2020, 04:48 PM by josemendez.)
(03-06-2020, 04:43 PM)relevantname Wrote: Hi,
I wonder that, is obi rope can be used with creating a game like rope around. (https://www.youtube.com/watch?v=eB0atpB4hNY)
I saw your video(https://www.youtube.com/watch?v=Czy6WnIWtyY) and I tried to do the same all day long but I failed miserably. So, I wanted to ask that if this can be done or it is really hard to achieve this sort of effect with obi rope.
P.S: I'm using ObiRope 4.
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.
Posts: 27
Threads: 12
Joined: Mar 2020
Reputation:
0
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;
}
}
Posts: 6,309
Threads: 24
Joined: Jun 2017
Reputation:
399
Obi Owner:
04-06-2020, 08:06 AM
(This post was last modified: 04-06-2020, 08:17 AM by josemendez.)
Rope Around does not dynamically add/remove rope as far as I'm aware. It's just a long rope sticking out of a hole, attached to an object that keeps it tense. That's all. This way you get the same performance regardless of the amount of rope on screen, which is a plus too.
In case you wanted to dynamically add/remove rope (not recommended in this case), that's what cursors are for :
http://obi.virtualmethodstudio.com/tutor...ursor.html
Posts: 27
Threads: 12
Joined: Mar 2020
Reputation:
0
04-06-2020, 08:46 AM
(This post was last modified: 04-06-2020, 09:06 AM by relevantname.)
(04-06-2020, 08:06 AM)josemendez Wrote: Rope Around does not dynamically add/remove rope as far as I'm aware. It's just a long rope sticking out of a hole, attached to an object that keeps it tense. That's all. This way you get the same performance regardless of the amount of rope on screen, which is a plus too.
In case you wanted to dynamically add/remove rope (not recommended in this case), that's what cursors are for :
http://obi.virtualmethodstudio.com/tutor...ursor.html
Hmm, but how do I setup a rope like this? If I use a really long rope, it won't be tight? And it does not stick to the out of the tube.
Thank you so much
Edit: I think I need to use a real tube with the radius of around the rope's thickness
And in the rope around, if I exaggerate the move, the rope ends. So, it is using a single very long rope like you said.
Posts: 6,309
Threads: 24
Joined: Jun 2017
Reputation:
399
Obi Owner:
04-06-2020, 09:24 AM
(This post was last modified: 04-06-2020, 09:28 AM by josemendez.)
(04-06-2020, 08:46 AM)relevantname Wrote: Hmm, but how do I setup a rope like this? If I use a really long rope, it won't be tight? And it does not stick to the out of the tube.
Thank you so much
Edit: I think I need to use a real tube with the radius of around the rope's thickness
And in the rope around, if I exaggerate the move, the rope ends. So, it is using a single very long rope like you said.
Hi,
To prevent stretching (= slow convergence) you can just crank up the amount of substeps up. That will yield near unstretchable rope. Since there's no regular (Unity) physics involved, you don't pay the price of collision detection for each substep.
On the subject of convergence/substeps/iterations (which is physics simulation 101), I highly recommend reading the following link. Might take a while to sink in, but it is really useful:
http://obi.virtualmethodstudio.com/tutor...gence.html
Substeps basically divide each physics step into multiple smaller steps. Advancing the simulation using smaller timesteps prevents the rope from getting into "very" invalid state after each step, so the solver has to do less work to bring it back to a valid state (fewer iterations).
Think of constraint iterations as a way to fix the errors introduced by the fact that physics in games are advanced in "stop-motion", and think of substeps as a way to reduce the amount of error that is introduced in the first place.
Posts: 27
Threads: 12
Joined: Mar 2020
Reputation:
0
(04-06-2020, 09:24 AM)josemendez Wrote: Hi,
To prevent stretching (= slow convergence) you can just crank up the amount of substeps up. That will yield near unstretchable rope. Since there's no regular (Unity) physics involved, you don't pay the price of collision detection for each substep.
On the subject of convergence/substeps/iterations (which is physics simulation 101), I highly recommend reading the following link. Might take a while to sink in, but it is really useful:
http://obi.virtualmethodstudio.com/tutor...gence.html
Substeps basically divide each physics step into multiple smaller steps. Advancing the simulation using smaller timesteps prevents the rope from getting into "very" invalid state after each step, so the solver has to do less work to bring it back to a valid state (fewer iterations).
Think of constraint iterations as a way to fix the errors introduced by the fact that physics in games are advanced in "stop-motion", and think of substeps as a way to reduce the amount of error that is introduced in the first place.
Thank you for support. I'll look at the tutorial.
If I use a real tube for the rope(to prevent left-right swinging), the rope's particles collides with this tube all the time and I need to extract the contact points other than the tube. Is there an easy way to do this other than loop through the whole contacts list every frame and pick the objects other than the tube? (Like, collide with object but not collect contact points for this object)
Posts: 6,309
Threads: 24
Joined: Jun 2017
Reputation:
399
Obi Owner:
(04-06-2020, 09:57 AM)relevantname Wrote: If I use a real tube for the rope(to prevent left-right swinging), the rope's particles collides with this tube all the time and I need to extract the contact points other than the tube. Is there an easy way to do this other than loop through the whole contacts list every frame and pick the objects other than the tube? (Like, collide with object but not collect contact points for this object)
A collision with any object means that contact points have been generated between the rope and the object. You can't have a collision with no contact points generated.
Now, performing any kind of filtering over the contacts requires to iterate over them at least once. Even when Unity calls OnCollisionEnter() for a given pair of objects, internally it has iterated trough all contacts in the scene to find out what callbacks to call.
Broadly speaking, there's no way to tell if an object is or isn't in a list without looking at all objects at least once.
So, the easiest (and only) way to do what you need (in any engine) is to iterate over the contacts list once and pick whatever objects you need.
Posts: 27
Threads: 12
Joined: Mar 2020
Reputation:
0
(04-06-2020, 10:13 AM)josemendez Wrote: A collision with any object means that contact points have been generated between the rope and the object. You can't have a collision with no contact points generated.
Now, performing any kind of filtering over the contacts requires to iterate over them at least once. Even when Unity calls OnCollisionEnter() for a given pair of objects, internally it has iterated trough all contacts in the scene to find out what callbacks to call.
Broadly speaking, there's no way to tell if an object is or isn't in a list without looking at all objects at least once.
So, the easiest (and only) way to do what you need (in any engine) is to iterate over the contacts list once and pick whatever objects you need.
Ok, thank you soo much
|