Posts: 13
Threads: 3
Joined: Jan 2022
Reputation:
0
Good afternoon, how to find out the tension force or remove the rope tension
There is a character with three ropes, there is the sum of the length of the ropes. In the screenshot, the left one has a length of 1, the right rope is 5. When I start to reduce the length of the right rope, it pulls the character along, thereby lengthening the left rope, I need it not to go beyond the range of its current length, if it comes out, then uncouple, how to find out when it goes beyond the range
By this method I change the length of the rope
ropeCursor.ChangeLength(rope.restLength + length)
Below I tried to find out how long the rope stretches when stretched, but unsuccessfully
x = rope.restLength;
y = rope.CalculateLength();
z = rope.restLength - rope.CalculateLength();
If you look at these values, then x = 1, y will range from 1 and above
Posts: 6,326
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
(22-11-2022, 10:10 AM)Kizzualx Wrote: Below I tried to find out how long the rope stretches when stretched, but unsuccessfully
x = rope.restLength;
y = rope.CalculateLength();
z = rope.restLength - rope.CalculateLength();
If you look at these values, then x = 1, y will range from 1 and above
Hi!
x is the length of the rope in meters, at rest, so if it's 1 it means your rope is 1 meter long.
y would be the current length of the rope including stretching/compression. So if your rope is stretched and its rest length is 1, y will always be larger than 1.
I'm not sure I understood your question... the tension force of a rope is a force, if you remove it then the rope will basically collapse under its own weight due to gravity. What you want to find is strain, that is the amount of elongation the rope is undergoing, expressed as a percentage. It can be calculated like this:
Code: float strain = rope.restLength / rope.CalculateLength();
strain will be 1 if the rope is not elongated with respect to its rest length, 1.20 if it's elongated by 20%, 1.30 if it's elongated by 30% etc.
kind regards,
Posts: 13
Threads: 3
Joined: Jan 2022
Reputation:
0
(22-11-2022, 10:52 AM)josemendez Wrote: Hi!
x is the length of the rope in meters, at rest, so if it's 1 it means your rope is 1 meter long.
y would be the current length of the rope including stretching/compression. So if your rope is stretched and its rest length is 1, y will always be larger than 1.
I'm not sure I understood your question... the tension force of a rope is a force, if you remove it then the rope will basically collapse under its own weight due to gravity. What you want to find is strain, that is the amount of elongation the rope is undergoing, expressed as a percentage. It can be calculated like this:
Code: float strain = rope.restLength / rope.CalculateLength();
strain will be 1 if the rope is not elongated with respect to its rest length, 1.20 if it's elongated by 20%, 1.30 if it's elongated by 30% etc.
kind regards, I need the rope, which is already hooked, not to stretch when pulling the other one, but to uncouple the hook, how do I know when to uncouple
Posts: 6,326
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
(22-11-2022, 01:06 PM)Kizzualx Wrote: I need the rope, which is already hooked, not to stretch when pulling the other one, but to uncouple the hook, how do I know when to uncouple
What do you mean by "uncouple the hook"? If you mean disabling the attachment, you can do that when the strain exceeds a threshold you define. For instance if the rope is stretched by more than 30% (strain > 1.30) then you disable the attachment.
cheers,
Posts: 13
Threads: 3
Joined: Jan 2022
Reputation:
0
(22-11-2022, 01:53 PM)josemendez Wrote: What do you mean by "uncouple the hook"? If you mean disabling the attachment, you can do that when the strain exceeds a threshold you define. For instance if the rope is stretched by more than 30% (strain > 1.30) then you disable the attachment.
cheers, yes, that's exactly what I mean, but the problem is that when I pull even one rope, an object is attached to it, it stretches even more than when two ropes are stretched, is it possible that it doesn't stretch?
Posts: 6,326
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
23-11-2022, 09:47 AM
(This post was last modified: 23-11-2022, 09:48 AM by josemendez.)
(23-11-2022, 08:59 AM)Kizzualx Wrote: yes, that's exactly what I mean, but the problem is that when I pull even one rope, an object is attached to it, it stretches even more than when two ropes are stretched, is it possible that it doesn't stretch?
I'm not entirely sure what you mean by "it stretches even more than when two ropes are stretched", could you share a video/screenshots of the problem?
If a rope stretches too much it's usually symptom of one of these:
- It's attached to dynamic objects (rigidbodies), but the attachments are set to static instead of dynamic.
- The rigidbodies attached to the rope have much greater mass that the rope.
- Not enough substeps being used, or too high rope resolution.
let me know if I can be of further help,
Posts: 13
Threads: 3
Joined: Jan 2022
Reputation:
0
(23-11-2022, 09:47 AM)josemendez Wrote: I'm not entirely sure what you mean by "it stretches even more than when two ropes are stretched", could you share a video/screenshots of the problem?
If a rope stretches too much it's usually symptom of one of these:
- It's attached to dynamic objects (rigidbodies), but the attachments are set to static instead of dynamic.
- The rigidbodies attached to the rope have much greater mass that the rope.
- Not enough substeps being used, or too high rope resolution.
let me know if I can be of further help, where can I see the mass of the rope, see the substeps and the resolution of the rope
Posts: 6,326
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
(23-11-2022, 11:30 AM)Kizzualx Wrote: where can I see the mass of the rope, see the substeps and the resolution of the rope
Those are all pretty important settings, specially substeps and resolution.
Mass of the rope: per-control point, in the path editor:
http://obi.virtualmethodstudio.com/manua...setup.html
Resolution: in the rope blueprint:
http://obi.virtualmethodstudio.com/manua...setup.html
Substeps: in the updater component (by default, ObiFixedUpdater):
http://obi.virtualmethodstudio.com/manua...aters.html
kind regards,
Posts: 13
Threads: 3
Joined: Jan 2022
Reputation:
0
Posts: 6,326
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
(25-11-2022, 08:47 AM)Kizzualx Wrote: I have another question, why does the rope go through the wall?
Hi!
Because the mesh is not readable.
You need to enable the Read/write checkbox in the mesh import settings, as the error message instructs you to do.
Note that if you don't make the mesh readable but use it in a MeshCollider and:
-The Mesh Collider’s Transform has negative scaling (for example, (–1, 1, 1)) and the Mesh is convex.-
-The Mesh Collider’s transform is skewed or sheared (for example, when a rotated transform has a scaled parent transform).
-The Mesh Collider’s Cooking Options flags are set to any value other than the default.
It won't work. This is standard Unity behavior and holds true regardless of you using Obi or not.
https://docs.unity3d.com/Manual/class-MeshCollider.html
kind regards,
|