Search Forums

(Advanced Search)

Latest Threads
Broken scripts with updat...
Forum: Obi Rope
Last Post: hariedo
7 hours ago
» Replies: 0
» Views: 21
Garment explodes on Andro...
Forum: Obi Cloth
Last Post: CptnFabulous
19-12-2024, 07:16 AM
» Replies: 4
» Views: 658
Calculating and Reproduci...
Forum: Obi Fluid
Last Post: ZacharyP
18-12-2024, 05:49 PM
» Replies: 2
» Views: 757
Null Reference, actor not...
Forum: Obi Rope
Last Post: josemendez
13-12-2024, 12:39 PM
» Replies: 1
» Views: 140
Issue with Grasping ObiRo...
Forum: Obi Rope
Last Post: josemendez
12-12-2024, 12:00 PM
» Replies: 5
» Views: 419
Changing extruded rendere...
Forum: Obi Rope
Last Post: aderae
10-12-2024, 07:35 PM
» Replies: 2
» Views: 220
Baking a rope is causing ...
Forum: Obi Rope
Last Post: josemendez
10-12-2024, 11:06 AM
» Replies: 6
» Views: 624
Barrier belt - changing l...
Forum: Obi Rope
Last Post: josemendez
10-12-2024, 10:42 AM
» Replies: 1
» Views: 202
Path editor gizmo's appea...
Forum: Obi Rope
Last Post: josemendez
10-12-2024, 09:50 AM
» Replies: 1
» Views: 196
Problems when using multi...
Forum: Obi Cloth
Last Post: Cat3Man
09-12-2024, 03:17 AM
» Replies: 2
» Views: 270

 
  Multi selected ObiCollider is changed only one
Posted by: asimofu_ok - 28-08-2024, 11:39 AM - Forum: General - Replies (4)

Sorry for repeating myself, but this time it is about Obi7's ObiCollider.

When I try to change Thickness or ObiCollisionMaterial while multiple objects with ObiCollider are selected, it seems that only one of the selected objects is changed.
My Unity version is 2022.3.42.

Print this item

  Issues After Upgrading to Obi Rope 7: Bounciness, Jitter, and Rope Generation Problem
Posted by: Destro26 - 27-08-2024, 07:50 PM - Forum: Obi Rope - Replies (4)

Hello,

I recently upgraded to Obi Rope 7 and encountered a few issues issues with the ropes not behaving as they did in Obi Rope 6. I've kept the same settings from Obi 6 and am using the default settings for the new solver options (except for substeps, which I set to match the value I used in the Obi Fixed Updater).

In my game, the player can shoot ropes. I originally based this mechanic on the Extendable Grappling Hook script provided with Obi Rope, although I've modified it over time. After upgrading to Obi 7, I found that I could no longer shoot ropes at all. I noticed the Extendable Grappling Hook script had changed since Obi 6, so I tried to apply similar changes to my custom rope generation script. This allowed rope generation to work again, but I'm not sure if I implemented it correctly, and I suspect this might be related to some of the issues I'm experiencing (particularly issues 2 & 3 below).

I've attached a video showing the differences between Obi 6 and Obi 7.



There are the issues I'm having:

  1. Increased Rope Bounciness:
    • When lifting certain rigidbodies, the ropes are much more bouncy than they were in Obi 6.
  2. Rope Flashing in the Wrong Location:
    • Occasionally, when generating a rope, it momentarily appears to connect from the player’s hand to the world origin for one frame.
  3. Unpredictable Behavior When Shooting Ropes at Rigidbodies:
    • When shooting ropes at rigidbodies (e.g., a box), the behavior is inconsistent. Sometimes the box is lifted into the air or pushed around unexpectedly. I think this might be related to the issue mentioned above.
  4. Increased Rope Jitter:
    • When ropes are left to settle, there seems to be more residual movement in Obi 7 compared to Obi 6. I'm using the same sleep threshold in both versions.
This is my Rope Generation script. (For now I've modified the Change length method in ObiCursor so that I can just pass in the new length rather than the length change)
Code:
public class RopeGenerator : MonoBehaviour{
        public float breakThreshhold = 0.1f;
        public float extraRopeLengthOnSpawn = 0;
        [SerializeField] private bool _useTearing;
        [SerializeField] private float _tearResistance = 800;

        [Range(0, 2)]
        [SerializeField] private float _stretchingScale = 1;
       
        public ObiSolver solver;
        public Material material;
        public ObiRopeSection section;

        [Range(0, 1)]
        public float hookResolution = 0.5f;

        //public float hookExtendRetractSpeed = 2;

        [FormerlySerializedAs("hookShootSpeed")]
        public float ropeShootSpeed = 1;

        public int particlePoolSize = 100;

        public float ropeParticleInverseMass = 100.0f;

        //public ObiRope rope;
        [SerializeField] private float ropeThickness = 0.5f;
        [SerializeField] private float cursorParticle = 4f;
        [SerializeField] private float sourceParticle = 2f;
        [SerializeField] private bool particleRendererOn = false;
        [SerializeField] private bool _useSurfaceCollision;
       
        public void InitialiseRope(RopeData ropeData, Action ropeInitialised = null) {
            if (ropeData.IsInitialised) {
                return;
            }
            // Setup a blueprint for the rope:
            ropeData.Blueprint = ScriptableObject.CreateInstance<ObiRopeBlueprint>();
            ropeData.Blueprint.resolution = hookResolution;
            ropeData.Blueprint.pooledParticles = particlePoolSize;

            // Create both the rope and the solver:    
            ropeData.ObiRope = ropeData.RopeObject.AddComponent<ObiRope>();
            ropeData.RopeObject.AddComponent<ObiParticleRenderer>().enabled = particleRendererOn;

            ObiRopeExtrudedRenderer ropeRenderer = ropeData.RopeObject.AddComponent<ObiRopeExtrudedRenderer>();
            ropeRenderer.section = section;
            ropeRenderer.uvScale = new Vector2(1, 4);
            ropeRenderer.normalizeV = false;
            ropeRenderer.uvAnchor = 1;
            ropeRenderer.material = material;
            //ropeData.RopeObject.GetComponent<MeshRenderer>().material = material;

            // Tweak rope parameters:
            ropeData.ObiRope.maxBending = 0.02f;

            // Add a cursor to be able to change rope length:
            ropeData.Cursor = ropeData.RopeObject.AddComponent<ObiRopeCursor>();
            ropeData.Cursor.cursorMu = 0;
            ropeData.Cursor.direction = false;

            ropeData.ObiRope.tearingEnabled = _useTearing;
            if (_useTearing) {
                ropeData.ObiRope.tearResistanceMultiplier = _tearResistance;
            }

            ropeData.ObiRope.surfaceCollisions = _useSurfaceCollision;

            ropeData.ObiRope.stretchingScale = _stretchingScale;
            StartCoroutine(InitialiseRopeRoutine(ropeData, ropeInitialised));
        }

        IEnumerator InitialiseRopeRoutine(RopeData ropeData, Action ropeInitialised = null) {
            var localHit = Vector3.forward;

            // Procedurally generate the rope path (just a short segment, as we will extend it over time):
            int filterCollision = ObiUtils.MakeFilter(ObiUtils.CollideWithEverything, 0);
            int filterNoCollision = ObiUtils.MakeFilter(ObiUtils.CollideWithNothing, 0);

            ropeData.Blueprint.path.Clear();
            ropeData.Blueprint.path.AddControlPoint(Vector3.zero, Vector3.zero, Vector3.zero, Vector3.up, 1 / ropeParticleInverseMass, 0.1f, ropeThickness, filterCollision, Color.white,
                "Rope start");
            ropeData.Blueprint.path.AddControlPoint(localHit.normalized * 0.5f, Vector3.zero, Vector3.zero, Vector3.up, 1 / ropeParticleInverseMass, 0.1f, ropeThickness, filterCollision,
                Color.white, "Rope end");

            ropeData.Blueprint.path.FlushEvents();

            // Generate the particle representation of the rope (wait until it has finished):
            yield return ropeData.Blueprint.Generate();
            ropeData.IsInitialised = true;
            yield return null;
            ropeInitialised?.Invoke();
        }

        private void LayParticlesInStraightLine(Vector3 origin, Vector3 direction, ObiRope rope)
        {
            // placing all particles in a straight line, respecting rope length
            float length = 0;
            for (int i = 0; i < rope.elements.Count; ++i)
            {
                int p1 = rope.elements[i].particle1;
                int p2 = rope.elements[i].particle2;
                solver.prevPositions[p1] = solver.positions[p1] = origin + direction * length;
                length += rope.elements[i].restLength;
                solver.prevPositions[p2] = solver.positions[p2] = origin + direction * length;
            }
        }
       
        public void GenerateRope(RopeData ropeData, RopeControlPoint sourceRcp, RopeControlPoint endRcp, Action<RopeData> onRopeGenerated, bool generateImmediately) {
            StartCoroutine(GenerateRopeRoutine());

            IEnumerator GenerateRopeRoutine() {
                var endRcpPosition = endRcp.transform.position;
                yield return null;
                // Clear pin constraints:
                var pinConstraints = ropeData.ObiRope.GetConstraintsByType(Oni.ConstraintType.Pin) as ObiConstraints<ObiPinConstraintsBatch>;
                pinConstraints.Clear();

                if (generateImmediately) {
                    InitialiseRope(ropeData);
                }

                // Set the blueprint (this adds particles/constraints to the solver and starts simulating them).
                ropeData.ObiRope.ropeBlueprint = ropeData.Blueprint;
                ropeData.ObiRope.GetComponent<ObiRopeExtrudedRenderer>().enabled = true;

                // wait for the solver to load the rope, after the next physics step:
                yield return new WaitForFixedUpdate();
                yield return null;
                // set masses to zero, as we're going to override positions while we extend the rope:
                if (!generateImmediately) {
                    for (int i = 0; i < ropeData.ObiRope.activeParticleCount; ++i)
                        solver.invMasses[ropeData.ObiRope.solverIndices[i]] = 0;
                }

                float currentLength = 0;
                const float maxPercentOfDistance = 0.75f; // the max percent of the distance between the source and the hit that the rope can extend to in one frame
               
                //move definitions out of loop
                Vector3 origin;
                Vector3 direction;
               
                // while the last particle hasn't reached the hit, extend the rope:
                do {
                    //--Set Cursor and source to a set number of particles away from the end of the rope
                    SetCursorAndSourceMu(ropeData, cursorParticle, sourceParticle);

                    // calculate rope origin in solver space:
                    origin = solver.transform.InverseTransformPoint(sourceRcp.transform.position); //spawn from rope origin
                    // update direction and distance to hook point:
                    direction = endRcpPosition - origin;
                    float distance = direction.magnitude;
                    direction.Normalize();
                   
                    LayParticlesInStraightLine(origin, direction, ropeData.ObiRope);
                   
                    if (generateImmediately) {
                        ropeData.Cursor.ChangeLength(distance + extraRopeLengthOnSpawn);
                    }
                    else {
                        // calculate the max increment for this frame to stop the increment from being larger than the distance.
                        float maxIncrement = distance * maxPercentOfDistance;
                        var increment = ropeShootSpeed;

                        increment = Mathf.Min(maxIncrement, increment);
                        // increase length:
                        currentLength += increment;
                        // if we have reached the desired length, break the loop:
                        if (currentLength >= distance) {
                            ropeData.Cursor.ChangeLength(distance + extraRopeLengthOnSpawn);
                            break;
                        }

                        // change rope length (clamp to distance between rope origin and hook to avoid overshoot)
                        ropeData.Cursor.ChangeLength(Mathf.Min(distance, currentLength));
                    }
                    yield return null;
                } while (!generateImmediately);

                // wait for the last length change to take effect, and ensure the rope is straight:
                yield return new WaitForFixedUpdate();
                yield return null;
                LayParticlesInStraightLine(origin, direction, ropeData.ObiRope);
               
                // restore masses so that the simulation takes over now that the rope is in place:
                for (int i = 0; i < ropeData.ObiRope.activeParticleCount; ++i)
                    solver.invMasses[ropeData.ObiRope.solverIndices[i]] = ropeParticleInverseMass; // 1/0.1 = 10

                // Pin both ends of the rope (this enables two-way interaction between character and rope):
                var batch = new ObiPinConstraintsBatch();
                batch.AddConstraint(ropeData.ObiRope.elements[0].particle1, sourceRcp.ObiCollider, Vector3.zero, Quaternion.identity, 0, 1000, breakThreshhold);
                batch.AddConstraint(ropeData.ObiRope.elements[^1].particle2, endRcp.ObiCollider, Vector3.zero, Quaternion.identity, 0, 1000, breakThreshhold);
                batch.activeConstraintCount = 2;
                pinConstraints.AddBatch(batch);

                ropeData.ObiRope.SetConstraintsDirty(Oni.ConstraintType.Pin);

                //--Set Cursor and source to a set number of particles away from the end of the rope
                SetCursorAndSourceMu(ropeData, cursorParticle, sourceParticle);

                //Add Rope Data to both Control points
                endRcp.RopeActivated(ropeData);     // must happen before onRopeGenerated Electrics needs to know the RCPs Rope Data
                endRcp.InitialisePointOnRopeGenerated(ropeData);     // must happen before onRopeGenerated Electrics needs to know the RCPs Rope Data
                onRopeGenerated?.Invoke(ropeData); // calls hand wait finished, source.RopeActivated, RopeManager.RopeGenerated and RcpAttachPoint.AttachRcp
            }
        }
        public void SetCursorAndSourceMu(RopeData ropeData, float cursorParticlesFromEnd, float sourceParticlesFromEnd) {
            cursorParticlesFromEnd = Mathf.Clamp(cursorParticlesFromEnd, 2.0f, (float)ropeData.ObiRope.activeParticleCount - 2);
            sourceParticlesFromEnd = Mathf.Clamp(sourceParticlesFromEnd, 2.0f, (float)ropeData.ObiRope.activeParticleCount - 2);
            ropeData.Cursor.cursorMu = 1 - cursorParticlesFromEnd / ropeData.ObiRope.activeParticleCount;
            ropeData.Cursor.sourceMu = 1 - sourceParticlesFromEnd / ropeData.ObiRope.activeParticleCount;
        }
    }


Any advice or suggestions on how to resolve these issues would be greatly appreciated!
Thanks in advance!

Print this item

  Possible Bug in ObiRopeCursor Class Leading to Infinite Rope Length
Posted by: Destro26 - 25-08-2024, 01:42 PM - Forum: Obi Rope - Replies (2)

Hi. I've recently upgraded to Obi 7 and believe I've encountered a bug in the "ObiRopeCursor" class. Specifically, I'm able to increase the length of a rope indefinitely.

The issue arises when the maximum number of particles is reached. As the rope's length continues to increase, additional length is added to "m_CursorElement.restLength", but there appears to be no limit in place. This causes a section of the rope to appear as a straight line, which doesn't seem intended.

To confirm, I replicated this issue in the Crane example scene within a fresh Unity project with Obi 7 installed.

I found a potential solution by modifying the code on line 208 in the Rope_OnSimulate method:

Original Code (Line 208):

Code:
// Line 208
if (lengthChange > 0)
m_CursorElement.restLength += lengthChange;

Proposed Solution:

Code:
if (lengthChange > 0 && m_CursorElement.restLength < rope.ropeBlueprint.interParticleDistance)
{
      m_CursorElement.restLength = Mathf.Min(m_CursorElement.restLength + lengthChange, rope.ropeBlueprint.interParticleDistance)
}

This change ensures that the 'restLength' does not exceed the 'interParticleDistance', preventing the unintended straight-line section of the rope.

Print this item

  How to Controll Rope Elements/segmrents and have better collision
Posted by: Barax94 - 25-08-2024, 02:14 AM - Forum: Obi Rope - Replies (3)

What im trying to do with OBI Rope is a simple weaving mechanics. In which i have rows of cylinders and then I use the rope in this case the wefts to move across and wrap around thos columns back and forth:

Notes
Im using OBI-Rope Version 7
Im using the Cursor to add new segements/Particles at the end of the rope

Main Issuses


  1. When I hit the down or up arrows using rigidbody force to move the rope 1 unit along a clyinder,, the whole rope is affected, But what i want is on ly for the last one or last to segments to be affected by this force and all the previous one should stay where they at. ( Shown at the end of the attched video)
  2. When the rope is moving faster the collision breaks and rope goes through the columns/warps. but if I move it slower it seems to act good which brings us to issue #3
  3. Im building on top of the Wrap-The-Rope  Sample scene, which by default has a tension. I can stop this tension by making the start attchment as Static by then i lose the colliding 
My questions are
  • How to control specific segemnts as to freeze their position once created and only move the last n-ones
  • How to have collison not be broken no matter how fast or streched is the rope
  • How to stop/ disable the tension without the comprimising the dyniamic bhaviour of the attched ends
  1.  

Print this item

  Folded Cloth
Posted by: vrtraining - 23-08-2024, 07:37 AM - Forum: Obi Cloth - Replies (3)

I'm trying to create a folded cloth and then unfold it with two corner points. I have mesh below with control points highlighted.

[Image: Screenshot-2024-08-23-at-11-27-30-AM.png]

[Image: Screenshot-2024-08-23-at-11-27-39-AM.png]

Now I have created two control groups, and did static attachment with objects. Now I move both attachments in opposite direction to unfold the cloth but it doesn't work properly. It stretches the the same small folded patch like below

[Image: Screenshot-2024-08-23-at-11-35-54-AM.png]

Print this item

  Scale Issue
Posted by: vrtraining - 22-08-2024, 09:09 AM - Forum: Obi Cloth - Replies (3)

Hi, I'm a bit new to Obi Cloth (I'm using Obi Rope since long time so I'm familiar with basic Obi components).

I'm facing a problem of scale. If Game Object which Obi Cloth is attached is scaled down to 0.5,0.5,0.5 then it creates a problem in simulation.

At scale 1,1,1 in Unity Transform I get correct simulation when it falls down like image below
[Image: A.png]


At scale 0.5,0.5,0.5 in Unity Transform I get this strange incorrect simulation when it falls down like image below
[Image: B.png]


I tried changing the scale in BluePrint but It doesn't effect, the object is occupies same amount of space.

Print this item

  Chain Renderer with Burst can not use Point Light
Posted by: asimofu_ok - 22-08-2024, 08:11 AM - Forum: Obi Rope - Replies (6)

I updated to Obi 7 and Chain Renderer no longer accepts forward_add passes for Point Light, Spot Light, etc.
The render is built-in and the Solver is Burst.

There seems to be a problem with Graphics.RenderMeshInstanced() used in BurstChainRopeRenderSystem.cs but I don't know what to do.

Print this item

  Demo Scene - Snake - Navmesh
Posted by: devmert - 20-08-2024, 08:27 PM - Forum: Obi Rope - Replies (3)

Hello,

The controls of the snake in your Snake demo are good but I want to move it only on the ground using the point&click logic mechanics using the navmesh agent.

How can I do it?
Thanks

Print this item

  Selecting Objects in Hierarchy Triggers Unintentional Physics
Posted by: PRodi - 19-08-2024, 11:52 PM - Forum: Obi Rope - Replies (2)

Hi,

I’m using Obi Rope Version 7.0.1 with Unity 2022.3.42f1, and my project is built with URP. I’m trying to create a lamp with a cable in VR that is attached to the ceiling. I based it on the "Chains" scene but encountered some issues:

  1. Whenever I select something in the Scene, Hierarchy, or Project, it triggers movement of the object hanging on the rope.
  2. When the object is hanging on the rope, it randomly jumps after standing still for some time, and this behavior repeats constantly.
I've attached a video demonstrating the issue:
https://www.youtube.com/watch?v=CNmVGeAQKo8

Additional Question: Is there a more efficient or performant method for creating hanging lamps with cables compared to using the "Chains" scene as a base?

Any assistance would be greatly appreciated.

Print this item

  Obi Rope Prefab Pluger not working
Posted by: PRodi - 19-08-2024, 04:05 AM - Forum: Obi Rope - Replies (2)

Hi,

I’m using Unity 2022.3.42f1, and my project is built with URP. After freshly downloading and installing Obi Rope into my project, I encountered some errors/bugs:
In your "ElectricalWires" scene, when I copy the Obi Solver in the Hierarchy or create a new prefab from the Obi Solver and try to use it in the same scene, I encounter the following errors after pressing the play button:

NullReferenceException: Object reference not set to an instance of an object
Obi.ObiRopePrefabPlugger.OnEnable () (at Assets/Obi/Scripts/RopeAndRod/Utils/ObiRopePrefabPlugger.cs:27)

(The same issue occurs if I try to duplicate any of the Obi Ropes multiple times in the scene hierarchy. Some instances work fine, and I can see sparks after tearing apart cables, but others generate these errors.)

I would like to use this as a prefab in my other game levels.

Can you please assist me in resolving this error?

Thank you for your help.

Print this item