Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rope going through wall
#1
I know this has been asked a lot of times, but for me, it still doesnt work. I have tried increasing increasing thickness of cable(it worked to some degree, but for my game, I want to have the cable thick maximum of 2 cm, so i cant really have like 10 cm thick cable), I have also increased thickness of walls to 0.1, increased substeps and steps in solvers, increased Max Depenetration, Particle CCD and increasing the mass of the cable particles. I dont know what to try else, do I really need to increase the thickness of the cable or is there any other way to do this?
Attaching all screenshots and a video:
https://drive.google.com/file/d/1oJGXjXl...sp=sharing


Attached Files Thumbnail(s)
                   
Reply
#2
(Yesterday, 11:59 AM)Paul1 Wrote: I know this has been asked a lot of times, but for me, it still doesnt work. I have tried increasing increasing thickness of cable(it worked to some degree, but for my game, I want to have the cable thick maximum of 2 cm, so i cant really have like 10 cm thick cable), I have also increased thickness of walls to 0.1, increased substeps and steps in solvers, increased Max Depenetration, Particle CCD and increasing the mass of the cable particles. I dont know what to try else, do I really need to increase the thickness of the cable or is there any other way to do this?
Attaching all screenshots and a video:
https://drive.google.com/file/d/1oJGXjXl...sp=sharing

Hi,

This doesn’t seem to be caused by tunneling (the rope isn’t moving that fast), so using ccd or increasing rope/collider thickness won’t help at all.

How are you attaching the rope to the character, and how are you moving the character around?
If the character is ignoring the forces applies by the rope when taut (because it is not a rigidbody, or it’s kinematic, or the attachment is static) then moving the character will simply force the rope into colliders, as the rope can’t keep the character from moving and so the only option it has to stop stretching further is to ignore collision constraints.


Kind regards,
Reply
#3
What I can see from the video is, some of the walls collides with rope well. The rope only goes through the last piece of wall. So maybe you should take a look at the difference of the good&bad walls. Most likely the bad one has a wrong Box collider boundary.
Reply
#4
Thank you both for replies. The wall, that goes through in the video, is mesh collider, used by the door walls, the next colliders are also mesh for next doors and for wall, going over the doors. They look to be positioned correctly, because my player cant go through, that also confirms unitys gizmos.
The player is kinematic, because Im using Photon Fusion 2's KCC, which makes player kinematic. I want for my game to be kinematic to particles anyway, but want to have an option, if the cable detects tear, that it does not cut the rope, but if the player is holding it, it releases the rope. I havent done this yet, didnt check manual yet, do you think once I do this, I wouldnt have any those problems anymore? And if so, what should I use for detecting? Does API detect rope tearing, if the constraint is disabled? Or should I make my own tearing detection code?

Thank you again for replies.
Best, Paul
Reply
#5
(10 hours ago)Paul1 Wrote: Thank you both for replies. The wall, that goes through in the video, is mesh collider, used by the door walls, the next colliders are also mesh for next doors and for wall, going over the doors. They look to be positioned correctly, because my player cant go through, that also confirms unitys gizmos.
The player is kinematic, because Im using Photon Fusion 2's KCC, which makes player kinematic. I want for my game to be kinematic to particles anyway, but want to have an option, if the cable detects tear, that it does not cut the rope, but if the player is holding it, it releases the rope. I havent done this yet, didnt check manual yet, do you think once I do this, I wouldnt have any those problems anymore? And if so, what should I use for detecting? Does API detect rope tearing, if the constraint is disabled? Or should I make my own tearing detection code?

Thank you again for replies.
Best, Paul
It may not be related to the cause of your problem, but why you use mesh collider as a box collider can simply achieve what you need? Mesh collider is a performance killer that should be avoided in almost all cases.
As to the tear method you mentioned, is it another requirement or it's a workaround you thought that may solve your origin problem (rope go through wall)?
As to the "rope go through wall" problem, please post the two Obi Collider screenshots (the one of the rope and the problem wall). You only post one in your first post.
And if you're moving player in a kinematic way it may be the cause, as josemend methoned.
Reply
#6
(10 hours ago)Paul1 Wrote: The player is kinematic, because Im using Photon Fusion 2's KCC, which makes player kinematic.

Kinematic objects have infinite mass so they will ignore any forces applied to them (a = F/m, if mass is infinite, acceleration is zero no matter how large the force you apply).

As a result, if you attach a rope (or any other physics object) to a kinematic object it will go wherever the kinematic object goes, as any force it applies on the kinematic object will be completely ignored. So all other constraints besides "stay attached to the kinematic object" will be ignored, this includes going inside or trough other objects in the scene if necessary.

(10 hours ago)Paul1 Wrote: I want for my game to be kinematic to particles anyway, but want to have an option, if the cable detects tear, that it does not cut the rope, but if the player is holding it, it releases the rope. I havent done this yet, didnt check manual yet, do you think once I do this, I wouldnt have any those problems anymore?

Right, if you make the character release the rope once it's stretched over its rest length, you won't have this problem anymore (as the rope is no longer attached to a kinematic object)

(10 hours ago)Paul1 Wrote: And if so, what should I use for detecting? Does API detect rope tearing, if the constraint is disabled? Or should I make my own tearing detection code?

You can check the constraint force of all distance constraints in the rope (this is what tearing does). If any is over a threshold value you define, detach the rope from the player. See ObiRope.cs for reference. Here's the relevant code:

Code:
            float sqrTime = substepTime * substepTime;

            var dc = GetConstraintsByType(Oni.ConstraintType.Distance) as ObiConstraints<ObiDistanceConstraintsBatch>;
            var sc = this.solver.GetConstraintsByType(Oni.ConstraintType.Distance) as ObiConstraints<ObiDistanceConstraintsBatch>;

            if (dc != null && sc != null)
            {
                for (int j = 0; j < solverBatchOffsets[(int)Oni.ConstraintType.Distance].Count; ++j)
                {
                    var batch = dc.GetBatch(j) as ObiDistanceConstraintsBatch;
                    var solverBatch = sc.batches[j] as ObiDistanceConstraintsBatch;

                    for (int i = 0; i < batch.activeConstraintCount; i++)
                    {
                        int elementIndex = j + 2 * i;

                        int offset = solverBatchOffsets[(int)Oni.ConstraintType.Distance][j];

                        // divide lagrange multiplier by squared delta time to get force in newtons:
                        float force = solverBatch.lambdas[offset + i] / sqrTime;


                        if (-force > tearResistanceMultiplier)
                        {
                            // one rope element is over the force threshold, react to it.
                        }
                    }
                }
            }
Reply