Search Forums

(Advanced Search)

Latest Threads
Scripting rod forces
Forum: Obi Rope
Last Post: chenji
Yesterday, 01:15 PM
» Replies: 25
» Views: 2,380
Burst error causing crash...
Forum: Obi Rope
Last Post: josemendez
10-09-2025, 07:03 AM
» Replies: 1
» Views: 105
Controlling speed of emit...
Forum: Obi Fluid
Last Post: josemendez
06-09-2025, 06:29 AM
» Replies: 1
» Views: 335
Looks nice on editor but ...
Forum: Obi Fluid
Last Post: josemendez
04-09-2025, 07:20 AM
» Replies: 3
» Views: 615
How to Shorten or Scale t...
Forum: Obi Rope
Last Post: josemendez
02-09-2025, 09:53 AM
» Replies: 5
» Views: 703
The Limitation of Using O...
Forum: Obi Rope
Last Post: josemendez
01-09-2025, 10:30 PM
» Replies: 1
» Views: 457
Bug Where a Straight Segm...
Forum: Obi Rope
Last Post: josemendez
01-09-2025, 08:46 PM
» Replies: 1
» Views: 454
Having an issue with obi ...
Forum: Obi Rope
Last Post: Ben_bionic
29-08-2025, 04:23 PM
» Replies: 4
» Views: 919
Non-uniform particle dist...
Forum: Obi Rope
Last Post: chenji
29-08-2025, 09:05 AM
» Replies: 4
» Views: 789
Is it possible to impleme...
Forum: Obi Rope
Last Post: chenji
27-08-2025, 10:13 AM
» Replies: 2
» Views: 705

 
  Rope going inside the table
Posted by: kripa1415 - 19-06-2024, 06:55 AM - Forum: Obi Rope - Replies (3)

Hi,
 Please check this video. when a shape with obicollider collides with the rope, rope goes inside the table ignoring collision.
 Shape ObiCollider rigidbody has constraints x and z rotation locked and y position locked. Attached rigidbody, collider, solver and rope config snapshots.

 Rope creation:
 

Code:
private IEnumerator CreateRope(ObiSolver solver, ObiRope rope)
{
    // Create a rope
   
    // Setup a blueprint for the rope:
    var blueprint = ScriptableObject.CreateInstance<ObiRopeBlueprint>();
    blueprint.resolution = 0.65f;
    blueprint.thickness = 0.07f;
    blueprint.pooledParticles = 5;


    Vector3 point = Vector3.zero;
    blueprint.path.Clear();
    int filter = ObiUtils.MakeFilter(ObiUtils.CollideWithEverything, 0);
    float mass = 1;
    for (int i = 0; i < points.Length; i++)
    {
        if (i == 0 || i == points.Length - 1)
        {
            mass = .001f;
            filter = ObiUtils.MakeFilter(ObiUtils.CollideWithEverything, 2);
        }
        else
        {
            mass = .002f;
            filter = ObiUtils.MakeFilter(ObiUtils.CollideWithEverything, 0);
        }
        if( i == 0 )
        {
            point = rope.transform.InverseTransformPoint(points[i].position);
            blueprint.path.AddControlPoint(point, -Vector3.zero, Vector3.zero, Vector3.up, mass, 0.5f, 1, filter, Color.white, "A");
            continue;
        }

        Vector3 point2 = rope.transform.InverseTransformPoint(points[i].position);
        Vector3 direction = (point2 - points[i-1].position) * 0.25f;
       
        blueprint.path.AddControlPoint(point2, -direction, direction, Vector3.up, mass, 0.5f, 1, filter, Color.white, points[i].name);
       
        // convert both points to the rope's local space:
        /*pointA = rope.transform.InverseTransformPoint(pointA);
        pointB = rope.transform.InverseTransformPoint(pointB);

        // Procedurally generate the rope path (a simple straight line):
        Vector3 direction = (pointB - pointA) * 0.25f;
        blueprint.path.Clear();
        blueprint.path.AddControlPoint(pointA, -direction, direction, Vector3.up, 0.1f, 0.1f, 1, 1, Color.white, "A");
        blueprint.path.AddControlPoint(pointB, -direction, direction, Vector3.up, 0.1f, 0.1f, 1, 1, Color.white, "B");*/
    }

    blueprint.path.FlushEvents();
    yield return StartCoroutine(blueprint.Generate());

    rope.collisionMaterial = collisionMaterial;
    rope.ropeBlueprint = blueprint;

    // access the distance constraints currently simulated by the solver:
    var solverConstraints = rope.GetConstraintsByType(Oni.ConstraintType.Distance)
                as ObiConstraints<ObiDistanceConstraintsBatch>;
    int batches = solverConstraints.batches.Count;
    for (int k = 0; k < batches; k++)
    {
        int cnt = solverConstraints.batches[k].constraintCount;
        for (int i = 0; i < cnt; i++)
        {
            solverConstraints.batches[k].restLengths[i] = length;
        }
    }
   
   

    var obiRopeExtrudeRenderer = rope.GetComponent<ObiRopeExtrudedRenderer>();
    // load the default rope section:
    obiRopeExtrudeRenderer.section = Resources.Load<ObiRopeSection>("DefaultRopeSection");
    obiRopeExtrudeRenderer.GetComponent<MeshRenderer>().material = material;
    obiRopeExtrudeRenderer.GetComponent<ObiPathSmoother>().decimation = 0.1f;
    obiRopeExtrudeRenderer.GetComponent<ObiPathSmoother>().smoothing = 3;

    cursor = rope.AddComponent<ObiRopeCursor>();
    cursor.cursorMu = 1;
    cursor.sourceMu = 1;

    rope.GetComponent<TangledRope>().cursor = cursor;

    obiRopeExtrudeRenderer.uvScale = new Vector2(2, 15);
    obiRopeExtrudeRenderer.thicknessScale = 1.1f;

    rope.distanceConstraintsEnabled = true;
    rope.stretchingScale = 1f;
    rope.stretchCompliance = 0f;
    rope.bendCompliance = 1f;
 
 



    PinRope(rope, points[0].GetComponent<ObiCollider>(), points[points.Length - 1].GetComponent<ObiCollider>(), new Vector3(0f, 0, 0), new Vector3(0f, 0, 0));

    //RopeAttachment(rope, points[0].GetComponent<ObiCollider>(), points[points.Length - 1].GetComponent<ObiCollider>());

    //AddDistanceConstrants(rope);

}
 
 https://drive.google.com/file/d/1YVsB6C8r1uQpQkQYQFSzM0K3RfHVj_f3/view?usp=sharing



Attached Files Thumbnail(s)
               
Print this item

  Indexing Particles while using Obi Rope Cursor
Posted by: MisterToot - 17-06-2024, 10:20 AM - Forum: Obi Rope - Replies (2)

Once a cursor is added to a rope (and the length is altered) it looks like the index of the particles no longer returns in a nice order using the below method:

Code:
// first particle in the rope is the first particle of the first element:
int firstParticle = rope.elements[0].particle1;

// last particle in the rope is the second particle of the last element:
int lastParticle = rope.elements[rope.elements.Count-1].particle2;

// now get their positions (expressed in solver space):
var firstPos = rope.solver.positions[firstParticle];
var lastPos  = rope.solver.positions[lastParticle];

Instead, I have found I'll get the index of the first particle correct, and the last particle index will be at the first cursor spawn position, and then after that, I can't spy an order to the particles. 

I'm using two cursors both facing inward in case that context matters, though I've found the same issue with just one cursor in the crane demo scene also.

Any clues/advice from folks for how to get a nice ordered index of them?

Print this item

  Obi Fluid Renderer not working on URP
Posted by: CosmosST - 17-06-2024, 07:49 AM - Forum: Obi Fluid - Replies (8)

Hello,

I can't get the Obi Fluid Renderer working on URP. The Obi Particles render fine. 

I have set the Obi Fluid Renderer feature and the script. 

When I check the shaders I see the following errors. Any idea ?  ( OSX , Sonoma )

I don't see any console errors.

thank you.



Attached Files Thumbnail(s)
       
Print this item

  Cave diving and cave crawing simulator in VR
Posted by: goosejordan - 17-06-2024, 07:37 AM - Forum: Made with Obi - Replies (2)

Hello!

I've been working on a caving simulator for some time now. Obi has become an integral part to get rope climbing, guidelines and hoses interactive! It's incredible what it can do :O

I'm seeing some performance issues from the high fidelity of the rope, but hopefully the new GPU accelerated version can improve on that!

Print this item

  Every Job.Worker thread is "Idle"
Posted by: cubrman - 16-06-2024, 08:00 PM - Forum: Obi Cloth - Replies (12)

Hi,

I've set up Obi solver to Use Burst, I have a TONE of work for it - the game is running at 1 FPS in editor, but when I go to Profiler, it shows fully occupied main thread with ObiFixedUpdater.FixedUpdate() while every Job.Worker thread is Idle
[Image: 1.png]
Have I made a mistake somewhere?

Print this item

  System.ObjectDisposedException: The UNKNOWN_OBJECT_TYPE has been deallocated
Posted by: bugbeeb - 15-06-2024, 01:25 AM - Forum: Obi Rope - Replies (2)

Seeing this exception when debugging in visual studio,

System.ObjectDisposedException: The UNKNOWN_OBJECT_TYPE has been deallocated, it is not allowed to access it
  at (wrapper managed-to-native) Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckDeallocateAndThrow_Injected(Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle&)
  at Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckDeallocateAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) [0x00000] in <0652bf0e14024522b5c92574ad0ef550>:0
  at Obi.ObiNativeList`1[T].Dispose (System.Boolean disposing) [0x0003d] in C:\Users\bugbe\SpinnyWheels\Assets\Obi\Scripts\Common\DataStructures\NativeList\ObiNativeList.cs:110
  at Obi.ObiNativeList`1[T].Finalize () [0x00002] in C:\Users\bugbe\SpinnyWheels\Assets\Obi\Scripts\Common\DataStructures\NativeList\ObiNativeList.cs:90


Unity version 2022.3.30
Obi Rope Version 6.5.4

Print this item

  Cloth curtain
Posted by: balaji.v - 13-06-2024, 01:38 PM - Forum: Obi Cloth - Replies (2)

Hi,
How can we implement a obi cloth curtain that can expand and shrink using controller drag in Quest?

Thanks.

Print this item

  Finding Rope existence on mouse click
Posted by: kripa1415 - 13-06-2024, 08:37 AM - Forum: Obi Rope - Replies (2)

Hi,
 Is it possible to find if there is any rope exists on mouse clicked position  ?
 something like Physics.OverlapSphere() by passing position and collision radius ?

Print this item

  Efficiently determine actor under ray
Posted by: 4ringz - 12-06-2024, 11:47 PM - Forum: General - Replies (2)

Hi,

I'd appreciate some quick advice re: whether there's a more performant way to accomplish what I'm trying to do OOTB. For a first-person "grabbing" system I need to get the particle and related Actor (specifically softbody, but right now code works w/ all actors) closest to an origin point with a given ray.

My current code (adapted crudely from the particle picker example scripts) works, but as it's iterating through A) all particle positions and then B) an undetermined number of softbodies and each of their particles again to relate the particle to an Actor, it's quite inefficient, as I may need many softbodies as well as non-softbody particles in my scenes.

If there are cached bounds/extents per Obi actor I could cluster them into volumes, cast the ray through volumes, and then only iterate over each of their particles, but if those structures exist in ObiActor I can't seem to locate them.

Appreciate any help, thanks!

Code:
    public ObiActor GetActor(ObiSolver solver, int particleIndex){
        foreach (ObiActor actor in solver.actors){
            for (int i = 0; i < actor.solverIndices.count; i++){
                if (actor.solverIndices[i] == particleIndex){
                    return actor;
                }
            }
        }
        return null;
    }

    public int Raycast(ObiSolver solver, Ray ray, float radiusScale, float maxDistance, Vector3 origin){
        if (solver == null) return 1;

        int hitParticle = -1;
        float closestMu = float.MaxValue;
        float closestDistance = float.MaxValue;
        Matrix4x4 solver2World = solver.transform.localToWorldMatrix;

        // Find the closest particle hit by the ray
        for (int i = 0; i < solver.positions.count; ++i){

            Vector3 worldPos = solver2World.MultiplyPoint3x4(solver.positions[i]);

            if (Vector3.Distance(worldPos, origin) > maxDistance) continue;

            float mu;
            Vector3 projected = ObiUtils.ProjectPointLine(ray.origin, ray.origin + ray.direction, worldPos, out mu, false);
            float distanceToRay = Vector3.SqrMagnitude(worldPos - projected);

            // Disregard particles behind the camera:
            mu = Mathf.Max(0, mu);

            float radius = solver.principalRadii[i][0] * radiusScale;
            if (distanceToRay <= radius * radius && distanceToRay < closestDistance && mu < closestMu){
                closestMu = mu;
                closestDistance = distanceToRay;
                hitParticle = i;
            }
        }

        return hitParticle;

Print this item

  Towel simulation in Quest
Posted by: balaji.v - 12-06-2024, 07:31 AM - Forum: Obi Cloth - Replies (13)

Hi,

I am working on a VR project where I need to grab a towel using a controller and then fold and unfold it, as well as rub the cloth on other objects with collision.

Could you please suggest possible ways to achieve the above simulation?


Thanks.

Print this item