Search Forums

(Advanced Search)

Latest Threads
Rope with sharp change in...
Forum: Obi Rope
Last Post: Fuzzypeg
Yesterday, 02:44 PM
» Replies: 2
» Views: 38
Parent Movement
Forum: Obi Softbody
Last Post: josemendez
Yesterday, 09:50 AM
» Replies: 5
» Views: 67
Does the Obi Rope support...
Forum: Obi Rope
Last Post: josemendez
Yesterday, 08:05 AM
» Replies: 7
» Views: 123
Attaching a rope and upda...
Forum: Obi Rope
Last Post: stateofplay
28-02-2024, 02:06 PM
» Replies: 4
» Views: 93
ObiCloth local space docu...
Forum: Obi Cloth
Last Post: josemendez
28-02-2024, 07:59 AM
» Replies: 1
» Views: 64
can tearablecloth be like...
Forum: Obi Cloth
Last Post: SansiroKrik
27-02-2024, 09:01 AM
» Replies: 11
» Views: 3,119
Physics-driven VR Fishing
Forum: Made with Obi
Last Post: astro.domine
26-02-2024, 09:54 PM
» Replies: 2
» Views: 358
Relax the rope when requi...
Forum: Obi Rope
Last Post: Romahaaa
26-02-2024, 11:03 AM
» Replies: 7
» Views: 522
Obi crash after reload sc...
Forum: Obi Rope
Last Post: kayrakocaeli
24-02-2024, 08:37 AM
» Replies: 4
» Views: 338
Problem with movement of ...
Forum: Obi Rope
Last Post: Alnik
23-02-2024, 06:08 PM
» Replies: 0
» Views: 107

 
  Rope with sharp change in thickness
Posted by: Fuzzypeg - Yesterday, 12:48 PM - Forum: Obi Rope - Replies (2)

Hi, I am trying to work out how to make a smoothed rope with a sharp change in thickness as shown in the attached image. 

Ideally I would like to disable smoothing between 2 control points but this does not appear to be an option. If I just set the thickness of the nodes, it is smoothed over the entire section, centered on the control point rather than starting from it and so I don't get the sharp transition I need.

I have tried adding a total of 4 control points across the area to force it, which looks visibly correct in the editor, but basically explodes at runtime, even with the nodes set to not collide with anything. I suspect it is because it is still trying to stuff 5 sections in between the control points and they are too close together.

Does anyone have any idea how this could be achieved other than having 2 ropes connected to a fixed mesh in the middle?



Attached Files Thumbnail(s)
   
Print this item

  Parent Movement
Posted by: BusraSevim - 28-02-2024, 10:07 AM - Forum: Obi Softbody - Replies (5)

Hello,

In my scene, there is a normal rotating cylinder and softbody spheres arranged around this cylinder. In order to attract the center of the cylinder, I apply a force to all spheres as follows:


Code:
var forceDirection = (spin.transform.position - transform.position).normalized;
softBall.AddForce(forceDirection * force, ForceMode.Acceleration);


But at the same time, the cylinder is the parent object of these spheres. And when I rotate the cylinder, I want these spheres to rotate with the cylinder, like normal spheres. But they don't rotate, I can only see the strain vibration. They can rotate when I turn off the softbody features, but I shouldn't turn them off.

The rotation code of the cylinder is as follows:


Code:
transform.Rotate(Vector3.forward,-_inputVector.x*spinRotateSpeed);


I use the solver and sphere softbody features in the sample scene named BallPool.

Thanks.

Print this item

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

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 (4)

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

  Problem with movement of ObiRopeAttachment
Posted by: Alnik - 23-02-2024, 06:08 PM - Forum: Obi Rope - No Replies

Hello everyone!

I have the following problem: I am trying to control the same crane with two clients that connect to a server via FishNet. As long as no player connects to the crane, the ObiSolver remains disabled and the spreader is simply dragged along as a child of the crane.

As soon as a player connects to the crane, the parenting of the spreader is changed and the ObiSolver is enabled so that the spreader is now only attached to the crane by the ropes. It should be noted that the ropes themselves are attached to a SpreaderAttachmentGO in a cabin GO that can be moved.

If you now move the cabin, the spreader also moves with it, as the SpreaderAttachment, just like the VCam, is attached to the cabin. If the first client now disconnects from the crane, the ObiSolver is disabled again. If the second client then connects to the crane, the VCam is packed to the position left by the first client, but the ropes spawn at the original position in the centre of the crane, i.e. as if the cabin movement had not taken place before. You can see this in the attached video.

What confuses me now is that in the SceneView (also in the video) you can see that the object on which the ropes are actually hanging is in the correct position, but for some reason the ropes themselves are hanging down vertically from the centre.

I was previously able to reproduce this behaviour independently of the network, i.e. in single player, but this was not always successful. The same behaviour can also be observed when the crane is moving. The ropes also spawn at the crane's point of origin.

Does anyone know what could be the reason for this? Does the position of the SpreaderAttachment have to be updated somehow in the ObiSolver? Could the alternating enable/disable of the ObiSolver lead to such behaviour? Originally I installed these changes because the performance was severely affected by the rendering of 60 different ObiSolvers for all cranes at once.

In the video, I also included the settings for the ObiSolver and for one ObiRope as an example.

Many thanks in advance!

Best regards,
Alexej

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 (3)

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