Search Forums

(Advanced Search)

Latest Threads
Rope going through wall
Forum: Obi Rope
Last Post: josemendez
Yesterday, 01:02 PM
» Replies: 5
» Views: 110
In SolidifyOnContact exsa...
Forum: Obi Fluid
Last Post: asimofu_ok
Yesterday, 11:38 AM
» Replies: 5
» Views: 124
Change rod section at run...
Forum: Obi Rope
Last Post: matty337s
02-08-2025, 06:07 AM
» Replies: 0
» Views: 67
Sliding along a rope
Forum: Obi Rope
Last Post: vrt0r
01-08-2025, 07:43 PM
» Replies: 0
» Views: 52
Is it possible to render ...
Forum: Obi Fluid
Last Post: asimofu_ok
01-08-2025, 10:07 AM
» Replies: 2
» Views: 110
Cloth has stretchy behavi...
Forum: Obi Cloth
Last Post: Andreia Mendes
31-07-2025, 02:38 PM
» Replies: 22
» Views: 925
Get separate particles pa...
Forum: Obi Fluid
Last Post: slimedev
29-07-2025, 06:51 PM
» Replies: 6
» Views: 3,262
Solver outside of hierarc...
Forum: General
Last Post: Jawsarn
29-07-2025, 06:19 PM
» Replies: 4
» Views: 207
Rope ignoring colliders o...
Forum: Obi Rope
Last Post: josemendez
24-07-2025, 07:03 AM
» Replies: 1
» Views: 146
Ladder made by Ropes (Rat...
Forum: Obi Rope
Last Post: josemendez
23-07-2025, 01:43 PM
» Replies: 5
» Views: 347

 
  ObiCloth local space documentation is outdated?
Posted by: CptnFabulous - 28-02-2024, 07:54 AM - Forum: Obi Cloth - Replies (3)

Hi!

I have an object with an ObiSolver attached, with several ObiCloth shapes as children. The parent object needs to be moved and teleported, but this causes the rendered cloth to behave like it’s simply moving at high speeds, causing it to glitch out and behave in unnatural ways. To solve this, I’m trying to make the cloth simulation happen in the solver’s local space instead of world space, so that the parent’s movements don’t affect the cloth simulation. Not 100% realistic, but good enough for my purposes.

I've looked in the forum but haven't found a clear answer. In some posts I’ve seen people say that the simulations always occur in the local space of the solver itself, but that should mean the cloth is already operating in local space, which isn’t happening. I also found values for determining how much the local space values are affected by world space movement, but those are both set to zero.

I’m trying to make the cloth render in the solver’s local space instead of world space, and am looking at this documentation to try and figure it out: https://obi.virtualmethodstudio.com/manu...space.html
I’m currently using ObiCloth version 6.5.4, in the Unity Editor 2021.3.3f1, but the only detailed version of the documentation is for an older version. The later versions are marked red as incomplete and can’t be selected.
The documentation shows that in ObiSolver there’s a bool to enable local space simulation, but when I look at the script (both in the Inspector and at the code itself), no option exists. The two options I mentioned for determining world space influence both have comments that reference a ‘simulateInLocalSpace’ option, but returns no results when I use FindAll across the entire solution (aside from those two comments). I’ve got two images here to show how different the ObiSolver is in the inspector.

The image shown in the documentation:
[Image: local_space_inspector.png]
The way it appears in my project:
[Image: PgaTuWH.png]

So in the version I’m using, what do I need to do to ensure the cloth simulates in local space? I presume the feature must have been refactored and moved to a different section of the code, as I refuse to believe such an important feature would be outright removed.

Thanks!

Print this item

  Does the Obi Rope support physics simulation on a dedicated server linux?
Posted by: oleegarch - 27-02-2024, 09:48 PM - Forum: Obi Rope - Replies (7)

On my server, I need to check the simulation of how the user played my game to determine whether he won or not. The winnings depend on the Obi Rope simulation. I added a rope, everything is fine, but after performing a simulation on the server, I discovered very strange behavior of the rope. Rope, as I understand it, is not supported on the dedicated server? Triste

Print this item

  Attaching a rope and updating position multiple times
Posted by: stateofplay - 27-02-2024, 03:02 PM - Forum: Obi Rope - Replies (5)

Hello,

I've been trying for the last couple of days to get the rope to do what we need and just can't quite get it to play nicely. Hoping you can help.

The use case is as follows:

  • The rope is attached to the ground at one end
  • Initially, the other end is attached to the player
  • At specific places, when the player initiates it, we want the rope to attach to a point on the wall
  • At this point, the rope would have three attachments (the ground, the point on the wall, and the player)
  • This will then happen repeatedly so the rope may eventually have six attachments for example (ground, wall, wall, wall, wall, player)
My first approach was to create a single rope and use a pre-built blueprint and then just update the blueprint as time went on, adding new particle attachments and using the cursor to extend the length of the rope, but I couldn't get it to work.

Second, I tried generating a blueprint with code in case that was the issue, no luck.

My current approach was to generate a new rope for each segment (so each rope would just have two attachments and there would be a series of ropes in a list).

When I try to do this, the first rope attaches as desired properly. The second rope, attaches, but the positions of the particles do no update. So I can see the particles are attached but they are not in the right place.

Here is the code I am using to control the rope:

Code:
public class RopeController : MonoBehaviour
{
    private ObiSolver _solver;
    private ObiRope _rope;
    private ObiRopeBlueprint _blueprint;
    private int _ropeId = -1;

    private string _cp1Name;
    private string _cp2Name;

    public void Init(int ropeId, float ropeLength, float ropeMass,
        float ropeRotationalMass, Transform attachment1, Transform attachment2)
    {
        StartCoroutine(InitCoro(ropeId, ropeLength, ropeMass, ropeRotationalMass, attachment1, attachment2));
    }

    private IEnumerator InitCoro(int ropeId, float ropeLength, float ropeMass,
        float ropeRotationalMass, Transform attachment1, Transform attachment2)
    {
        _ropeId = ropeId;
       
        _solver = GetComponentInParent<ObiSolver>();
        if (_solver == null)
        {
            Debug.LogError("No ObiSolver found in parent");
        }
        _rope = GetComponent<ObiRope>();
        _rope.GetComponent<MeshRenderer>().enabled = false;

        _blueprint = ScriptableObject.CreateInstance<ObiRopeBlueprint>();
        _blueprint.resolution = 1f;
        _blueprint.pooledParticles = 100;
        _blueprint.thickness = 0.03f;

        int filter = ObiUtils.MakeFilter(ObiUtils.CollideWithEverything, 0);
        Vector3 posCp1 = Vector3.zero;
        _cp1Name = $"Rope{_ropeId}_CP1";
        Vector3 posCp2 = new Vector3 (-4, 0, 0);
        _cp2Name = $"Rope{_ropeId}_CP2";
        _blueprint.path.Clear();
        _blueprint.path.AddControlPoint(posCp1, Vector3.zero, Vector3.zero, Vector3.up,
            ropeMass, ropeRotationalMass, 1f, filter, Color.white, _cp1Name);
        _blueprint.path.AddControlPoint(posCp2, Vector3.zero, Vector3.zero, Vector3.up,
            ropeMass, ropeRotationalMass, 1f, filter, Color.white, _cp2Name);
        _blueprint.path.FlushEvents();

        yield return _blueprint.Generate();

        _rope.ropeBlueprint = _blueprint;

        SetAttachment(attachment1, _cp1Name);
        SetAttachment(attachment2, _cp2Name);

        yield return null;

        _rope.GetComponent<MeshRenderer>().enabled = true;


        _rope.ropeBlueprint = _blueprint;
    }

    private void SetAttachment(Transform attachmentTarget, string particleGroupName)
    {
        // add a particle attachment to the rope
        var particleAttachment = _rope.gameObject.AddComponent<ObiParticleAttachment>();

        // disable the attachment
        particleAttachment.enabled = false;

        // find the particle group we want to attach to
        var particleGroup = _rope.ropeBlueprint.groups.Find(x => x.name == particleGroupName);

        // set the attachment's particle group to the one we found
        particleAttachment.particleGroup = particleGroup;

        // get the particle index of the first particle in the group
        var particleIndex = particleAttachment.particleGroup.particleIndices[0];

        // set the position of that particle to the attachment target
        _solver.positions[particleIndex] = _solver.transform.InverseTransformPoint(attachmentTarget.position);

        // set the attachment's target to the transform we want to attach to
        particleAttachment.target = attachmentTarget;

        // re-enable the attachment
        particleAttachment.enabled = true;
    }
}


and these are instantiated from a system class as follows:

Code:
public class RopeSystemIncremental : MonoBehaviour
{
    [SerializeField] private Material _ropeMat;
    [SerializeField] private Transform _groundAttachmentTra;
    [SerializeField] private Transform _playerAttachmentTra;
    [SerializeField] private Transform _TESTINGgrabbableAttachmentTra;
    [SerializeField] private RopeController _ropePF;

    private float _defaultRopeLength = 4f;
    private float _ropeMass = 0.1f;
    private float _ropeRotationalMass = 0.1f;
    private ObiSolver _solver;

    private List<RopeController> _ropes = new List<RopeController>();

    private void Awake()
    {
        _solver = GetComponentInChildren<ObiSolver>();
    }

    [ContextMenu("FirstOne")]
    private void FirstOne()
    {
        InstantiateRope(_groundAttachmentTra, _playerAttachmentTra);
    }

    [ContextMenu("SecondOne")]
    private void SecondOne()
    {
        InstantiateRope(_TESTINGgrabbableAttachmentTra, _playerAttachmentTra);
    }

    private RopeController InstantiateRope(Transform attachment1, Transform attachment2)
    {
        var ropeCont = Instantiate(_ropePF, Vector3.zero, Quaternion.identity, _solver.transform);
        _ropes.Add(ropeCont);
        ropeCont.gameObject.name = "Rope " + _ropes.Count;
        ropeCont.Init(_ropes.Count, _defaultRopeLength, _ropeMass, _ropeRotationalMass, attachment1, attachment2);
        return ropeCont;
    }
}

Been hitting my head against the wall with this for a while now! Would really appreciate your help. Many thanks in advance.

Print this item

  How To Avoid This Problem
Posted by: Raymond - 23-02-2024, 10:30 AM - Forum: Obi Rope - Replies (1)

I have tried adding iterations of particle collision constrain and open surface collision but it still can not be avoid;

Print this item

  How to simulate Obi Rope physics?
Posted by: oleegarch - 21-02-2024, 06:09 PM - Forum: Obi Rope - Replies (1)

When i use in unity

Code:
Physics.Simulate(Time.fixedDeltaTime);
The Obi Rope is not simulated. Do I understand correctly that Obi Rope need to be simulated in a separate script? If it is true, how i can do this?

I'm developing a game where i need to detect in my server that user actually wins. My full code of simulation process:

Code:
private void Start() {
    Physics.simulationMode = SimulationMode.Script;
    Simulate();
}

private void Simulate() {
    GameObject machine = Instantiate(machinePrefab);
    MachineController controller = machine.GetComponent<MachineController>();
    APIMachineControlStateRequest request = JsonUtility.FromJson<APIMachineControlStateRequest>(json);
    controller.SetSimulate(Physics.defaultPhysicsScene);
    foreach(MachineControlState state in request.value) {
        controller.SetState(state);
        Physics.Simulate(Time.fixedDeltaTime);
    }
}
When i start it, Obi Rope behave unpredictably

Print this item

Pregunta Aligning collision with Obi Rope Mesh Renderer
Posted by: joegatling - 20-02-2024, 05:03 PM - Forum: Obi Rope - Replies (2)

Hello, I am new to Obi Rope, and I am struggling to get my rod's collision to line up with the geometry from the Obi Rope Mesh Renderer. I'm hoping someone can point me in the right direction.

What I am Trying to Do:
I am trying to make a game with a tentacled sea monster. My plan is to model the tentacle in Blender, then apply it to a rod using the ObiRopeMeshRender component. The tentacle itself is thicker at the base and tapers towards the tip. I want the collision of the object to reflect this.
   

The Problem:
I was hoping to add control points and use the thickness gizmo to line up the rope thickness by eye. However, when I do this, it also scales the mesh. I can't find a way to leave the mesh scale as is, and only modify the size of the ropes particles.
   

Am I approaching this the wrong way? I considered using an extruded shape, but ultimately I want a more detailed model so I figured the mesh renderer was the way to go.

Print this item

  Rope saving and restore
Posted by: Apoll0 - 20-02-2024, 08:27 AM - Forum: Obi Rope - Replies (4)

Hello!
I have this question, I'm making a game where ropes are tied in knots and hold each other. In the first version I tied all the ropes in the editor using blueprints, which I edited and then saved. In this variant the ropes hold each other quite well, even if you try to move them by static attachments. You don't have to move them much, so they don't usually go through each other.

Then I changed to an editor that runs in runtime, and you can tie the ropes by rearranging the attachments. Then I save positions and velocities in json for particles. I also save the position of attachments.

Then I restore them in the real game. First I load prefab, where the ropes are in the initial position, as in the template. Then I restore from json positions and velocities of particles. And positions of the attachments.
The ropes are restored without problems, they look exactly as they should at the beginning. But then the ropes start to hold each other very badly. They hold a little, but at any attempt to move them they start to pass through each other.

Maybe there's something else I'm forgetting to do. Maybe I need to call some method to rebuild some constraints after position and velocity of partials are restored?

This is my code for saving and restoring ropes it is script on the rope object itself. Tip1 and Tip2 - are static attachments

public JSONObject SaveRopeToJSONObject()
{
    var solver = _rope.solver;
    var particlesIndices = _rope.solverIndices;
    var positions = new List<Vector3>();
    var velocities = new List<Vector3>();
    for (int i = 0; i < particlesIndices.Length; i++)
    {
        positions.Add(solver.positions[particlesIndices[i]]);
        velocities.Add(solver.velocities[particlesIndices[i]]);
    }
   
    var positionsArray = new JSONArray();
    var velocitiesArray = new JSONArray();
    for (int i = 0; i < positions.Count; i++)
    {
        var p = (JSONNode)positions[i];
        positionsArray.Add(p);
        var v = (JSONNode)velocities[i];
        velocitiesArray.Add(v);
    }
   
    var ropeObject = new JSONObject();
    ropeObject.Add("Tip1Pos", (JSONNode)_ropeTip1.transform.position);
    ropeObject.Add("Tip2Pos", (JSONNode)_ropeTip2.transform.position);
    ropeObject.Add("Tip1Rot", (JSONNode)_ropeTip1.transform.rotation.eulerAngles);
    ropeObject.Add("Tip2Rot", (JSONNode)_ropeTip2.transform.rotation.eulerAngles);
    ropeObject.Add("positions", positionsArray);
    ropeObject.Add("velocities", velocitiesArray);

    return ropeObject;
}


public void RestoreRopeFromJSONObject(JSONObject ropeObject)
{
    _ropeTip1.transform.position = (Vector3)ropeObject["Tip1Pos"];
    _ropeTip2.transform.position = (Vector3)ropeObject["Tip2Pos"];
    _ropeTip1.transform.rotation = Quaternion.Euler((Vector3)ropeObject["Tip1Rot"]);
    _ropeTip2.transform.rotation = Quaternion.Euler((Vector3)ropeObject["Tip2Rot"]);

    var ropeParticlesPosition = ropeObject["positions"].AsArray;
    var ropeParticlesVelocities = ropeObject["velocities"].AsArray;
   
    var solver = _rope.solver;
    var particlesIndices = _rope.solverIndices;
    for (int i = 0; i < particlesIndices.Length; i++)
    {
        solver.positions[particlesIndices[i]] = (Vector3)ropeParticlesPosition[i];
        solver.velocities[particlesIndices[i]] = (Vector3)ropeParticlesVelocities[i];
    }
}

Print this item

  Rope/rod freezing
Posted by: stepkka - 17-02-2024, 02:59 PM - Forum: Obi Rope - Replies (3)

I need to reset a rope to blueprint and freeze it. In addition, ideally I need to set the rope's parent to some object without a solver. I'm calling ResetParticles, but the rope's shape stays the same as the last frame before this procedure.
So.. can I reset particles and move the rope outside of solver, or this is not recommended? If I can, what other calls should I make to update the visuals of the rope after resetting?

Print this item

  Obi crash after reload scene
Posted by: kayrakocaeli - 15-02-2024, 03:01 PM - Forum: Obi Rope - Replies (4)

Im using obi rope on my character when I start the game the rope works perfectly but when I reload the scene on play or build I'm getting this error.
going to a different scene is working properly but if I load the scene with obi rope twice it crashes.

IndexOutOfRangeException: Index 0 is out of range of '0' Length.
Unity.Collections.NativeArray`1[T].FailOutOfRangeError (System.Int32 index) (at <ad3eaa0878d94cbe8e45f9c494d71647>:0)
Unity.Collections.NativeArray`1[T].CheckElementReadAccess (System.Int32 index) (at <ad3eaa0878d94cbe8e45f9c494d71647>:0)
Unity.Collections.NativeArray`1[T].get_Item (System.Int32 index) (at <ad3eaa0878d94cbe8e45f9c494d71647>:0)
Obi.BurstColliderWorld+IdentifyMovingColliders.Execute (System.Int32 i) (at Assets/Utility/Obi/Scripts/Common/Backends/Burst/Collisions/BurstColliderWorld.cs:154)
Unity.Jobs.IJobParallelForExtensions+ParallelForJobStruct`1[T].Execute (T& jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at <ad3eaa0878d94cbe8e45f9c494d71647>:0)
Unity.Jobs.JobHandle:ScheduleBatchedJobsAndComplete(JobHandle&)
Unity.Jobs.JobHandle:Complete()
Obi.BurstColliderWorld:UpdateWorld(Single) (at Assets/Utility/Obi/Scripts/Common/Backends/Burst/Collisions/BurstColliderWorld.cs:117)
Obi.ObiColliderWorld:UpdateWorld(Single) (at Assets/Utility/Obi/Scripts/Common/Collisions/ObiColliderWorld.cs:397)
Obi.ObiUpdater:BeginStep(Single) (at Assets/Utility/Obi/Scripts/Common/Updaters/ObiUpdater.cs:56)
Obi.ObiFixedUpdater:FixedUpdate() (at Assets/Utility/Obi/Scripts/Common/Updaters/ObiFixedUpdater.cs:46)

You can check my prefab below.
Thanks in advence.
[Image: jDirCVG]



Attached Files Thumbnail(s)
   
Print this item

  Stitching a Rod to Rope - another attempt at fishing rod
Posted by: stepkka - 15-02-2024, 12:56 PM - Forum: Obi Rope - Replies (3)

Trying to stitch a rope to the end of a rod. Created a GO, added a stitcher component. 
1. Rigidbodies were created automatically. By default it had gravity enabled and 1 kg weight. During runtime it was falling down to infinity. I've set it to not use gravity, now it floats around arbitrarily. Is that ok? I'd imagine it should stay somewhere close to the stitches.
2. The default new stitch points are in the middle of rod and rope. I figured out how to change them. However, if I exit the prefab mode and enter it again, the stitch points are back to default.
3. In any case, stitch does work but it stitches wrong points. I have 4 control points in rod blueprint and 2 control points in rope blueprint. At runtime, the stitching seems to happen between the rod at the point index 1 and some arbitrary point near the start of rope.
   
   


OK, just figured out that the stitch point gizmos are for the new stitches. I was trying to adjust them after I created a stitch. The correct workflow is to adjust the points, then press Add Stitch button. Now the stitch is at the correct position.
The first question still stands, what to do with an arbitrary rigidbody floating around?

Print this item