Search Forums

(Advanced Search)

Latest Threads
How to dynamically change...
Forum: Obi Rope
Last Post: josemendez
Yesterday, 04:16 PM
» Replies: 5
» Views: 141
Pipeline that bends
Forum: Obi Softbody
Last Post: josemendez
04-07-2025, 09:52 AM
» Replies: 13
» Views: 820
How to implement/sync Obi...
Forum: Obi Rope
Last Post: quent_1982
01-07-2025, 01:48 PM
» Replies: 2
» Views: 198
Collisions don't work con...
Forum: Obi Rope
Last Post: chenji
27-06-2025, 03:05 AM
» Replies: 3
» Views: 264
Force Zone apply differen...
Forum: Obi Rope
Last Post: chenji
26-06-2025, 11:41 AM
» Replies: 11
» Views: 776
Can I blend in and out of...
Forum: Obi Cloth
Last Post: josemendez
24-06-2025, 04:42 PM
» Replies: 3
» Views: 244
Using a rigidbody/collide...
Forum: Obi Cloth
Last Post: josemendez
24-06-2025, 09:29 AM
» Replies: 1
» Views: 152
Solver is too performance...
Forum: Obi Rope
Last Post: quent_1982
20-06-2025, 08:09 AM
» Replies: 40
» Views: 4,280
Obi 7 Model Scaling
Forum: Obi Cloth
Last Post: alkis
19-06-2025, 02:37 PM
» Replies: 2
» Views: 259
Obi Softbody instability?
Forum: Obi Softbody
Last Post: Aroosh
18-06-2025, 06:35 PM
» Replies: 0
» Views: 138

 
  Issues trying to trap object in cloth
Posted by: taehong.ahn - 11-04-2025, 10:13 AM - Forum: Obi Cloth - Replies (3)

I am trying to implement a landing net for a VR fishing game but I am having trouble keeping an object inside the net. The collisions seem to work well at times but the fish pierces through the net too easily. I have tried changing every setting possible with the information I gathered from the docs and the forum but I have yet to see any sign of success. Currently, the fish flies away with even a little bit of force from the rope but if I increase its mass to solve this problem the rope struggles to pick the fish up because it's too heavy. 

Below are the things I have tried alongside a video and images of the problem at hand. Any ideas on what I am doing wrong?

Things I have tried: 
ObiSolver

  • Increase Substeps
  • Enable/Disable Interpolation
  • Change Synchronization
  • Modify Collision settings (CCD, Collision Margin, Max Depenetration, Set Surface Collision Iterations to max)
  • Increase constraint iterations and try both Sequential and Parallel (Distance, Collision) 
ObiCloth
  • Use different Cloth/Rigidbody mass ratios (If fish is too heavy relative to cloth, it pierces easily. If it's the other way around, the fish becomes too bouncy)
  • Enable/Disable Surface Collision (Increase particle radius when disabled, decrease when enabled)
  • Use different combinations of Stretching scale and compliance
  • Add high friction/stickiness Obi Collision Materials to cloth and rigidbody.



   

   

   

Print this item

Pregunta How can I make my ropes not float upwards?
Posted by: anthony_dev - 07-04-2025, 01:47 PM - Forum: Obi Rope - Replies (1)

Hello,

I am trying to figure out a way to have multiple pin points on my rope so I can move them like a snake.

I am unable to figure out what may cause this bug, my rope is floating on the non-kinematic end. For context, the selected object is a kinematic pin on my rope, the other golden balls are non-kinematic obi rigid bodies.

I am providing my solver settings alongside my result in the attachment.

Here's the code snippet I used to create the rope:

(It is messy but I use it for having pre-existing control points in the scene, and creating a rope blueprint and a rope out of these existing control points called "snake pieces")

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using _Game.Scripts.GameplayElements.Snakes;
using Obi;
using UnityEngine;

namespace _Game.Scripts.Gameplay.Demo
{
    public class DemoSnake : MonoBehaviour
    {
        [SerializeField] private List<SnakePiece> snakePieces;
        [SerializeField] private ObiSolver solver;
        [SerializeField] private Material ropeMaterial;
        [SerializeField] private ObiRopeSection ropeSection;
        [SerializeField] private ObiCollisionMaterial collisionMaterial;
        [SerializeField] private float ropeThickness;
        [SerializeField] private ObiRope rope;
       
        private ObiCollider[] Colliders => snakePieces.Select(o => o.GetComponent<ObiCollider>()).ToArray();

        private void Start()
        {
            CreateSnake();
        }


        private void CreateSnake()
        {
            rope = CreateRopeProcedurally(this, Colliders, 0);
            PinRope(rope, Colliders);
        }
       
        public void PinRope(ObiRope rope, params ObiCollider[] colliders)
        {
            PinRopeEnds(rope, colliders);
           
            for (int i = 1; i < colliders.Length-1; i++)
            {
                var obiCollider = colliders[i];
                var attachment = rope.gameObject.AddComponent<ObiParticleAttachment>();
                attachment.attachmentType = ObiParticleAttachment.AttachmentType.Dynamic;
                attachment.target = obiCollider.transform;
                attachment.particleGroup = rope.ropeBlueprint.groups[i];
                attachment.compliance = 0F;
            }
        }

        public void PinRopeEnds(ObiRope rope, params ObiCollider[] colliders)
        {
            var colliderStart = colliders[0];
            var colliderEnd = colliders[^1];

            var startIndex = rope.ropeBlueprint.groups.FindIndex(g => g.name == "start");
            var endIndex = rope.ropeBlueprint.groups.FindIndex(g => g.name == "end");

            var attachmentStart = rope.gameObject.AddComponent<ObiParticleAttachment>();
            attachmentStart.attachmentType = ObiParticleAttachment.AttachmentType.Dynamic;
            attachmentStart.target = colliderStart.transform;
            attachmentStart.particleGroup = rope.ropeBlueprint.groups[startIndex];

            var attachmentEnd = rope.gameObject.AddComponent<ObiParticleAttachment>();
            attachmentEnd.attachmentType = ObiParticleAttachment.AttachmentType.Dynamic;
            attachmentEnd.target = colliderEnd.transform;
            attachmentEnd.particleGroup = rope.ropeBlueprint.groups[endIndex];
        }

        public ObiRope CreateRopeProcedurally(DemoSnake snake, ObiCollider[] controlPoints, int index = 0)
        {
            var ropeObject = new GameObject($"Rope_{index}");
            ropeObject.transform.parent = solver.transform;
           
            var rope = ropeObject.AddComponent<ObiRope>();
            var blueprint = CreateBlueprint(snake, controlPoints,out var length);
            rope.ropeBlueprint = blueprint;
            rope.distanceConstraintsEnabled = true;
            rope.stretchingScale = 0.5f;
            rope.surfaceCollisions = false;
            rope.collisionMaterial = collisionMaterial;
            rope.maxBending = 0.5f;
            rope.bendCompliance = 1f;
            rope.selfCollisions = true;
            var ropeRenderer = ropeObject.AddComponent<ObiRopeExtrudedRenderer>();
            ropeRenderer.material = ropeMaterial;
            ropeRenderer.section = ropeSection;
            var smoother = rope.GetComponent<ObiPathSmoother>();
            smoother.decimation = 0.1f;
            smoother.smoothing = 1;
            var ropeReel = ropeObject.AddComponent<ObiRopeReel>();
            ropeReel.enabled = false;
            ropeReel.outThreshold = 0.08f;
            ropeReel.inThreshold = 0.05f;
            ropeReel.outSpeed = 6f;
            ropeReel.inSpeed = 0.1f;
            ropeReel.maxLength = Mathf.Max(1f, length);
            var cursor = ropeObject.GetComponent<ObiRopeCursor>();
            cursor.cursorMu = 0.05f;
            cursor.sourceMu = 0.1f;
            return rope;
        }
       
        public ObiRopeBlueprint CreateBlueprint(DemoSnake snake, ObiCollider[] points, out float distance)
        {
            distance = 0;
            //Create the blueprint
            var blueprint = ScriptableObject.CreateInstance<ObiRopeBlueprint>();
            blueprint.resolution = 1f;
            blueprint.thickness = 0.03f;
            blueprint.pooledParticles = 0;
           
            //Convert ropePoints to controlPoints
            var controlPoints = new Vector3[points.Length];
            blueprint.path.Clear();
            blueprint.ClearParticleGroups();

            var placeholder = Vector3.back * 1000;

            for (int i = 0; i < controlPoints.Length; i++)
            {
                var point = points[i];
                var controlPoint = snake.transform.InverseTransformPoint(point.transform.position);
                controlPoints[i] = controlPoint;
                Vector3 previousPoint  =
                    i <= 0
                        ? placeholder
                        : controlPoints[i - 1];
                Vector3 nextPoint  =
                    i >= controlPoints.Length - 1
                        ? placeholder
                        : controlPoints[i + 1];
               
                previousPoint = previousPoint != placeholder
                    ? previousPoint
                    : controlPoint;
                nextPoint = nextPoint != placeholder
                    ? nextPoint
                    : controlPoint;
               
                if(i != 0) distance += Vector3.Distance(previousPoint, controlPoint);
               
                var inTangentVector = -(controlPoint - previousPoint) * 0.02f;
                var outTangentVector = (nextPoint - controlPoint) * 0.02f;
               
                blueprint.path.AddControlPoint(controlPoint, inTangentVector, outTangentVector,
                    Vector3.up, 0.1f, 0.1f, (i == 0 || i == controlPoints.Length-1 ? ropeThickness*0.8f : ropeThickness), 1, Color.white,
                    //i.ToString());
                    $"{(i == 0 ? "start" : i == controlPoints.Length - 1 ? "end" : i.ToString())}");
                blueprint.path.filters[i] = ObiUtils.MakeFilter(-1, 0);
            }
           
            blueprint.path.FlushEvents();
            return blueprint;
        }
    }
}

Print this item

  Updating softbody vertex color at runtime
Posted by: Aroosh - 03-04-2025, 07:32 AM - Forum: Obi Softbody - Replies (2)

Hello

I am using a vertex color shader with softbody and want to update the vertex colors for the mesh. The issue is when I try to get the mesh from Skinner it does not give me the mesh that's currently being used but instead gives the shared mesh. 

Thank
Aroosh

Print this item

Pregunta How can I detect my second actor in a solver?
Posted by: anthony_dev - 27-03-2025, 04:05 PM - Forum: Obi Rope - Replies (9)

Hi, I am working on a project where I need to check if a rope is colliding with another rope, if not I will then destroy that rope after enough frames without collision passes.

It is very similar to how `TangledRopes.unity` sample works. I access the solver and on `Solver.OnParticleCollision()`event I call my collision checker function, here's a snippet of the code and my issue:

 

Code:
private void Solver_OnParticleCollision(ObiSolver solver, ObiNativeContactList contacts)
{
for (int i = 0; i < contacts.count; ++i)
{
    var ropeA = solver.particleToActor[solver.simplices[contacts[i].bodyA]].actor;
    var ropeB = solver.particleToActor[solver.simplices[contacts[i].bodyB]].actor;

    if (ropeA == ropeB) //Always true for some reason
    {
        //Breakpoint
        continue;
    }

    //Do Something
}
}


I never can access to the "Do Something" part of the code. In my debugging I found that EVERY contact is from `Rope_0` and none is from `Rope_1`. The ropes are on top of eachother, even twisted together. They are under the same solver. They are both in group 0 in particles and points in blueprint.

Why may this be?

Print this item

  Obi 7 disable simulation
Posted by: natko1412 - 27-03-2025, 11:34 AM - Forum: Obi Rope - Replies (6)

Hi, in Obi6 I could disable simulation, but still have rendering done by not running code in custom Updater. How would I do this in new version?

This was my updater before:

Code:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using Obi;
/// <summary>
/// Updater class that will perform simulation during FixedUpdate(). This is the most physically correct updater,
/// and the one to be used in most cases. Also allows to perform substepping, greatly improving convergence.

//[AddComponentMenu("Physics/Obi/Obi Fixed Updater", 801)]
[ExecuteInEditMode]
public class CustomUpdater : ObiUpdater
{
    /// <summary>
    /// Each FixedUpdate() call will be divided into several substeps. Performing more substeps will greatly improve the accuracy/convergence speed of the simulation.
    /// Increasing the amount of substeps is more effective than increasing the amount of constraint iterations.
    /// </summary>
    [Tooltip("Amount of substeps performed per FixedUpdate. Increasing the amount of substeps greatly improves accuracy and convergence speed.")]
    public int substeps = 4;
    public bool solve = false;

    private float accumulatedTime;

    private void OnValidate()
    {
        substeps = Mathf.Max(1, substeps);
    }

    private void Awake()
    {
        accumulatedTime = 0;
    }

    private void OnDisable()
    {
        //Physics.autoSimulation = true;
    }

    private void FixedUpdate()
    {
        if (solve)
        {
            ObiProfiler.EnableProfiler();

            BeginStep(Time.fixedDeltaTime);

            float substepDelta = Time.fixedDeltaTime / (float)substeps;

            // Divide the step into multiple smaller substeps:
            for (int i = 0; i < substeps; ++i)
                Substep(Time.fixedDeltaTime, substepDelta, substeps - i);

            EndStep(substepDelta);

            ObiProfiler.DisableProfiler();

            accumulatedTime -= Time.fixedDeltaTime;
        }
    }

    private void Update()
    {
        ObiProfiler.EnableProfiler();
        Interpolate(Time.fixedDeltaTime, accumulatedTime);
        ObiProfiler.DisableProfiler();

        if (solve)
            accumulatedTime += Time.deltaTime;
    }
}

Print this item

  Reduce particles after blueprint created
Posted by: webmagic - 25-03-2025, 07:25 AM - Forum: Obi Softbody - Replies (1)

Hi Obi,

we have an rabbit using obi softbody, but we want more efficiency, so we want to reduce particles in specified part, for a rabbit we just want it's ears more soft, but want to reduce other body part's particles. 

we successfully deleted the particles (keep the bones particles) and updated the blueprint, but so sad when we start to run , error occured and even ai dont know why: 


IndexOutOfRangeException: Reading from index 7926 is out of range of '7920' Capacity.
Obi.ObiNativeList1[T].get_Item (System.Int32 index) (at Assets/Obi/Scripts/Common/DataStructures/NativeList/ObiNativeList.cs:86)
Obi.ObiShapeMatchingConstraintsBatch.Merge (Obi.ObiActor actor, Obi.IObiConstraintsBatch other) (at Assets/Obi/Scripts/Common/Blueprints/Constraints/Batches/ObiShapeMatchingConstraintsBatch.cs:179)
Obi.ObiConstraints1[T].Merge (Obi.ObiActor actor, Obi.IObiConstraints other) (at Assets/Obi/Scripts/Common/Blueprints/Constraints/ObiConstraints.cs:58)
Obi.ObiSolver.PushConstraints () (at Assets/Obi/Scripts/Common/Solver/ObiSolver.cs:2230)
Obi.ObiSolver.StartSimulation (System.Single stepDelta, System.Int32 simulationSteps) (at Assets/Obi/Scripts/Common/Solver/ObiSolver.cs:1647)
Obi.ObiSolver.LateUpdate () (at Assets/Obi/Scripts/Common/Solver/ObiSolver.cs:1169)

the main problem is that looks like when we recreated(updated) the blueprint, something wrong in formart, or the blueprint modified after bind ?? 

so is it possible to make this happen, or any tips for us, especially which part of obi codes need to read ??

Print this item

  unity6 errors
Posted by: lacasrac - 23-03-2025, 07:02 PM - Forum: Obi Rope - Replies (1)

System::InvalidOperationException: The UNKNOWN_OBJECT_TYPE has been declared as [ReadOnly] in the job, but you are writing to it.

This Exception was thrown from a job compiled with Burst, which has limited exception support.

0x00007ff81bba26ee (Unity) burst_abort


0x00007ff81bf91b13 (Unity) scripting_raise_exception

0x00007ff81b171a20 (Unity) AtomicSafetyHandle_CUSTOM_CheckWriteAndThrowNoEarlyOut


0x00007ff84667b46e (b17746e930b15012bc57d9fa4529f1d) Unity.Jobs.IJobParallelForExtensions.ParallelForJobStruct`1<Obi.InterpolationJob>.Execute(ref Obi.InterpolationJob jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex) -> void_1a17c9416545ae7079718413b8a5101d from UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (at E:/UnityProjects/Heimdall/Library/PackageCache/com.unity.burst@7a907cf5a459/.Runtime/unknown/unknown:0)

0x00007ff84667aebd (b17746e930b15012bc57d9fa4529f1d) a4a634249c44e2582a125e65e3f3bb03




Unity 6.0.42f1





Hello,



Can yomebody help me in this? unity 6 hdrp latest, obi7 not working, and pink materials


All the samples are not working Triste






Thanks, Leslie

Print this item

  Settings Obi Skinned Cloth
Posted by: cgwill - 22-03-2025, 09:02 PM - Forum: Obi Cloth - No Replies

Hello, i am trying to get the Obi Skinned Cloth going on my character (Exported from CC4) and have trouble configuring the cloth. I already tried different values per documentation but keep running into a problem where my colliders penetrate the cloth or cloth snaps away. Here you can see my problem with different values of the stretch compliance:
Stretch Compliance 0.5 Stretch compliance 0

The cloth mesh is set up similar as the demo scene. The other settings are in the attachments.

Would be grateful for any pointers in the right direction. Thanks in advance Sonrisa



Attached Files Thumbnail(s)
           
Print this item

  Growing a rope attached to an object
Posted by: sinoth - 18-03-2025, 12:20 AM - Forum: Obi Rope - Replies (1)

I have a rope attached statically via ObiParticleAttachment to an immobile object at the beginning, and a movable object (my hand in VR) at the end.

The initial scripted attach works great and the rope behaves as expected. However I can't figure out how to properly grow or shrink via the cursor.

The cursor is set to Cursor Mu 1, Source Mu 1, Direction checked. The rope does grow and shrink. However it seems that the ObiParticleAttachment becomes invalidated because of this. I attempted to repair the attachment every time the cursor is changed but this also fails -- the rope hangs limp as though unattached.

Code:
public class RopeController : MonoBehaviour
{
    public float speed = 0.1f;
    public GameObject handObject;
    private bool _addedAttachment;
    private ObiParticleAttachment _attachment;
    private ObiRopeCursor _cursor;
    private ObiParticleGroup _group;
    private ObiRope _rope;
    private InputAction _ropeDecrease;
    private InputAction _ropeIncrease;

    private void Start()
    {
        _ropeIncrease = InputSystem.actions.FindActionMap("Player").FindAction("Rope Increase");
        _ropeDecrease = InputSystem.actions.FindActionMap("Player").FindAction("Rope Decrease");
        _cursor = GetComponent<ObiRopeCursor>();
        _rope = _cursor.GetComponent<ObiRope>();
    }

    private void Update()
    {
        if (!_addedAttachment && _rope.solver.positions.count > 0)
        {
            var lastParticleInitId = _rope.elements[^1].particle2;
            _group = ScriptableObject.CreateInstance<ObiParticleGroup>();
            _group.particleIndices.Add(lastParticleInitId);

            _rope.solver.positions[lastParticleInitId] =
                _rope.solver.transform.InverseTransformPoint(handObject.transform.position);

            _attachment = gameObject.AddComponent<ObiParticleAttachment>();
            _attachment.attachmentType = ObiParticleAttachment.AttachmentType.Static;
            _attachment.particleGroup = _group;
            _attachment.target = handObject.transform;

            _addedAttachment = true;
        }

        if (!_addedAttachment || (!_ropeIncrease.IsPressed() && !_ropeDecrease.IsPressed()))
            return;

        if (_ropeIncrease.IsPressed())
            _cursor.ChangeLength(speed * Time.deltaTime);
        if (_ropeDecrease.IsPressed())
            _cursor.ChangeLength(-speed * Time.deltaTime);

        _rope.RebuildConstraintsFromElements();

        var lastParticleId = _rope.elements[^1].particle2;
        _group.particleIndices.Clear();
        _group.particleIndices.Add(lastParticleId);
        _rope.solver.positions[lastParticleId] =
            _rope.solver.transform.InverseTransformPoint(handObject.transform.position);
        _attachment.particleGroup = _group;
        _attachment.target = handObject.transform;
    }
}

The solver doesn't seem to be initialized in Start which is why I moved the initial attach logic to Update.

If there is a better way to do this please let me know. I just want to grow/shrink the rope from the end but still have it stuck to my hand.



I think I may have figured it out... I changed the attach at the bottom to this:

Code:
       var lastParticleId = _rope.elements[^1].particle2;
        _group.particleIndices.Clear();
        _group.particleIndices.Add(lastParticleId);
        _rope.solver.positions[lastParticleId] =
            _rope.solver.transform.InverseTransformPoint(handObject.transform.position);
        _attachment.enabled = false;
        _attachment.target = null;
        _attachment.target = handObject.transform;
        _attachment.enabled = true;

The main changes were to disable, target null, then set target, and re-enable. Is that the intended way to do this?

Also I'm unsure how RebuildConstraintsFromElements() fits into the picture... should this be called every time after cursor.ChangeLength is called?

Print this item

  Twisted Bones
Posted by: Jawsarn - 15-03-2025, 10:35 PM - Forum: Obi Rope - No Replies

Hello again.

I'm triyng out the bones for a tail for a character. I have set torsion compliance to 0, but even so the bones seems to roll into a twisted shape after some jumping movement is made.
The setup also seems to have some twistedness going on, even though only the root has a rotation. Is this intended behaviour?

Best regards,



Attached Files Thumbnail(s)
   
Print this item