Search Forums

(Advanced Search)

Latest Threads
Rope going through wall
Forum: Obi Rope
Last Post: josemendez
8 hours ago
» Replies: 1
» Views: 8
Change rod section at run...
Forum: Obi Rope
Last Post: matty337s
Yesterday, 06:07 AM
» Replies: 0
» Views: 42
Sliding along a rope
Forum: Obi Rope
Last Post: vrt0r
01-08-2025, 07:43 PM
» Replies: 0
» Views: 36
In SolidifyOnContact exsa...
Forum: Obi Fluid
Last Post: asimofu_ok
01-08-2025, 04:15 PM
» Replies: 2
» Views: 76
Is it possible to render ...
Forum: Obi Fluid
Last Post: asimofu_ok
01-08-2025, 10:07 AM
» Replies: 2
» Views: 98
Cloth has stretchy behavi...
Forum: Obi Cloth
Last Post: Andreia Mendes
31-07-2025, 02:38 PM
» Replies: 22
» Views: 887
Get separate particles pa...
Forum: Obi Fluid
Last Post: slimedev
29-07-2025, 06:51 PM
» Replies: 6
» Views: 3,210
Solver outside of hierarc...
Forum: General
Last Post: Jawsarn
29-07-2025, 06:19 PM
» Replies: 4
» Views: 186
Rope ignoring colliders o...
Forum: Obi Rope
Last Post: josemendez
24-07-2025, 07:03 AM
» Replies: 1
» Views: 138
Ladder made by Ropes (Rat...
Forum: Obi Rope
Last Post: josemendez
23-07-2025, 01:43 PM
» Replies: 5
» Views: 320

 
  Softbody on a character
Posted by: netjeenpetje - 13-05-2023, 10:22 PM - Forum: Obi Softbody - Replies (4)

Hi!

I was trying to imitate the sample (With a VRoid Model) as practice, but after tinkering with the parameters for a few hours, I cant seem to get a normal result. All the vertices are jumping all over the place and some body parts dont move at all. I also tried to create a blueprint with the exact settings as the sample character without any luck.

Any idea what I am doing wrong?

Unity 2021.3.22f1
Latest Obi versions (updated two weeks ago)

[Image: Sac8Ut1NrRNd.gif]

   
   

Thanks a lot in advance!

-Davy

Print this item

  Can you use mesh colliders with character cloth?
Posted by: AdamZ101 - 12-05-2023, 09:19 PM - Forum: Obi Cloth - Replies (4)

There's an asset called RASCAL which automatically generates mesh colliders for characters, and also updates those at runtime when using blendshapes. So the mesh colliders change shape/size depending on the blendshape. Is it possible to use those colliders with your cloth system? 

I tried to setup a shirt with a blueprint, but when I played the scene and then changed a blendshape slider on the body, the cloth didn't update. If I can't use mesh colliders, do you have another thought on how to handle blendshapes?

Thanks.

Print this item

  Error when installing the latest
Posted by: AdamZ101 - 12-05-2023, 07:34 PM - Forum: Obi Cloth - Replies (2)

Im using Unity 2022.2.19 HDRP, and I'm getting this error in your scripts:

Assets\Obi\Scripts\Common\Backends\Burst\DataStructures\NativeMultilevelGrid.cs(34,13): error CS0305: Using the generic type 'UnsafeList<T>' requires 1 type arguments

Assets\Obi\Scripts\Common\Backends\Burst\DataStructures\NativeMultilevelGrid.cs(88,36): error CS8377: The type 'NativeMultilevelGrid<T>.Cell<T>' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'NativeList<T>'

Please advise. Thanks.


No error in Unity 2021.3.25f1 LTS URP.

Print this item

  Jitter of softbody when moving attachment
Posted by: luvjungle - 12-05-2023, 12:16 PM - Forum: Obi Softbody - Replies (2)

Hi!

I have an attachment (static) that targets obi rigidbody which is child of my player.
When player moves in update, softbody jitters.
If my player moves in FixedUpdate() and Cinemachine Brain is set to FixedUpdate, there is no jitter, but the problem is that I can't use this setup (it breaks other stuff).

Is there a way to move attachment's target in Update() without causing softbody to jitter?
If I move target in editor (with gizmos), it seem that softbody is not jittering. Same, if I unparent target and move it by code.

It seems that the problem is in parent-child relation, but I can't figure it out.
If I just unparent target and move it to desired point (which is child of player) by setting Transform properties, or even by moving target's rigidbody (with interpolation or not) by rigidbody.MovePosition/MoveRotation, the jitter is there.
Same if I remove obi rigidbody and rigidbody from target.

No jittering when using Obi Late Updater, but simulation differs with different framerates, so I can't use it too

Please help.

Print this item

  NullReferenceException in ObiRopeCursor (build)
Posted by: natko1412 - 11-05-2023, 10:54 AM - Forum: Obi Rope - Replies (4)

Hi,

I am changing rope length in OnBlueprintLoaded callback. This works well in Editor, but in build I get
NullReferenceException in ObiRopeCursor script, line 131

Code:
NullReferenceException: Object reference not set to an instance of an object
at Obi.ObiRopeCursor.ChangeLength (System.Single newLength) [0x00001]
in C:\myProject\Assets\Obi\Scripts\RopeAndRod\Actors\ObiRopeCursor.cs:131

I guess that the rope reference in cursor is somehow null. How can this happen if it worked fine in Editor?

Thanks in advance for help

Print this item

  Rope extending faster
Posted by: rohit_dhak - 11-05-2023, 10:02 AM - Forum: Obi Rope - Replies (1)

Hello,

So I have one issue with my setup (check the attached video).
I am giving control inputs to all 4 ropes, with speed = 2 and time_dt = 0.01 with which I am controlling the ropes.

However as can be seen in the video, the attached object is falling slowly while the ropes are getting extending fast, creating an undesirable result.

I changed the speed to 1, which gives somewhat desirable output, but then the movement of the attached object is slow.

What I want is to move the object a bit faster but at the same time, the rope should also extend accordingly.

   


Video:

https://drive.google.com/file/d/1tO2XkxG...sp=sharing

Print this item

  Rope Tear Snapback
Posted by: Balin - 11-05-2023, 03:28 AM - Forum: Obi Rope - Replies (2)

Hi there,

I'm trying to develop a simulation of a ship mooring line breaking and snapping back. So far I've been able to get the rope to tear at one end programmatically, and it looks pretty good, but there are a few problems I'd like to solve: 

1. How does one increase the speed the rope flings back after being broken? I would assume it's tied to the tension, but I'm not 100% sure how to increase the tension without shrinking the rope (see below), which is what I saw suggested on another forum post here. Ideally I'd like a different way of doing this. 
2. After breaking the rope, it seemingly gets a lot smaller than its original size. See the images attached. In the custom script I wrote, I use a Cursor to reduce the size of the rope at the start so that the tension is increased. However, after breaking, it seems to get much smaller than what I set it to. Ideally I would like the rope to maintain its original length after being broken, so it could fling back and potentially reach its full length in the opposite direction.

Here's my very simple code so far:

Code:
public class TensionScript : MonoBehaviour
{
    public Transform attachmentA;
    public Transform attachmentB;
    public float timeScale;
    public bool reduceLength;
    public float length;
    ObiRope rope;

    void Start()
    {
        Time.timeScale = timeScale;
        rope = GetComponent<ObiRope>();
        if(reduceLength) GetComponent<ObiRopeCursor>().ChangeLength(Vector3.Distance(attachmentA.position, attachmentB.position) * length);
    }

    [ContextMenu("Tear")]
    void TearRope()
    {
        rope.Tear(rope.elements[rope.elements.Count - 1]);
        rope.RebuildConstraintsFromElements();
    }
}

Just to note: 
  • The rope only has two control points, one at each end.
  • All the bend and distance constraint options are set to 0. I believe this makes the rope as rigid as I want it, but let me know if I should change anything here.
  • Both ends have an ObiParticleAttachment on them.
  • After breaking, the rope swings around the bollard seemingly indefinitely, even though I have a dampening value set on the solver. Not sure what causes this.

Hopefully you understand my issue and what I would like to achieve here.

Cheers,
Balin



Attached Files Thumbnail(s)
       
Print this item

Bombilla rope start and end point mesh close
Posted by: emreaa - 09-05-2023, 04:29 PM - Forum: Obi Rope - Replies (1)

is there no code to close the ends of the rope?

Print this item

Gran sonrisa [SOLVED] Softbody mesh working weird when attached to chain (obi rope)
Posted by: eduardoseitz - 08-05-2023, 08:31 PM - Forum: Obi Softbody - Replies (11)

I am trying to use obi softbody and obi ropes together but the mesh is getting weird. Basically I have a chain attached to a stand gameObjet and a punchingBag gameObject, this setup working fine but whenever I add softbody component to the punchingBag it either starts moving on it's own weirdly or it becomes a puddle of mesh and fals into the ground.

Here is a drive folder with inspector screenshots, a video showing the problem in play mode and also the project folder if you need:
https://drive.google.com/drive/folders/1...share_link

I've also attached screenshots bellow. If you need more info let me know. Thank you in advance.

Edit: I am using unity 2021.3.1f1 on Windows 10, the assets used are ObiRope and ObiSoftbody.



Attached Files Thumbnail(s)
       
Print this item

Pregunta Softbody for a certain region
Posted by: Spartan190 - 08-05-2023, 07:29 PM - Forum: Obi Softbody - No Replies

Hi,

I'm currently working on a game where we want to have wiggly boobs for the character. The problem seems to be that the connection between the vertices I select by script and the particles I get at the and aren't working well.
My approach is the following: like if I would create the blueprint by hand I selected certain vertices that are connected to the bones of the boobs. Then I invert the selected particles and use the RemoveSelectedParticles method with the optimize to true.
The remaining selected particles I then use for the "chest" group which will be attaches to the body so they don't wiggle/move. Sadly the results aren't working well. There is particles that still wiggle even they they should be part of the body and others which are part of the boobs don't move at all.

Maybe you can also help me that I might be able to create the particles on my own and place particles based on the vertices I have:

This screenshot shows the particles that are created:
[attachment=1726]

This screenshot shows the vertices that I have from the bones:
   

This is the vertices that have been found in the vertexToParticles list after all the optimization etc.
[attachment=1728]

Here is the code I'm using:

Code:
using System.Collections;
using UnityEngine;
using Obi;
using ExternalPropertyAttributes;
using System;
using CurvedUI;
using System.Collections.Generic;
using System.Linq;

public class BoobsInteraction : MonoBehaviour
{
    [System.Serializable]
    public class BonesWithWeights
    {
        public string BoneName;
        public float WeightThreshold;
    }

    public Transform UpperChest;
    public SkinnedMeshRenderer BodyRenderer;
    public List<SkinnedMeshRenderer> AdditionalRenderers = new List<SkinnedMeshRenderer>();
    public ObiSoftbody SofbodyPrefab;
    public float DefaultBoobsHeight = 1.13f;
    public List<BonesWithWeights> bonesThresholds = new List<BonesWithWeights>()
    {
        new BonesWithWeights() { BoneName = "Bust1", WeightThreshold = 0.75f},
        new BonesWithWeights() { BoneName = "Bust2", WeightThreshold = 0.0f }
    };

    private ObiParticleAttachment _attachment;

    private struct BoneWithThreshold {
        public int BoneIndex;
        public float Threshold;
    }


        [Button]
    public void Initialize()
    {
        if (UpperChest == null) throw new ArgumentNullException($"Property {nameof(UpperChest)} is not set");
        if (BodyRenderer == null) throw new ArgumentNullException($"Property {nameof(BodyRenderer)} is not set");
        if (SofbodyPrefab == null) throw new ArgumentNullException($"Property {nameof(SofbodyPrefab)} is not set");


        ObiSoftbody softbodyInstance = GameObject.Instantiate(SofbodyPrefab);
        softbodyInstance.transform.position = BodyRenderer.transform.position;
        try
        {
            softbodyInstance.softbodyBlueprint = SetupBlueprint();
        } catch (Exception ex)
        {
            Debug.LogException(ex, this);
            float delta = BodyRenderer.transform.position.y + DefaultBoobsHeight - UpperChest.position.y;
            softbodyInstance.transform.position = BodyRenderer.transform.position - new Vector3(0.0f, delta, 0.0f);
        }

        _attachment = softbodyInstance.AddComponentIfMissing<ObiParticleAttachment>();
        _attachment.target = UpperChest;

        var bodySkinner = BodyRenderer.AddComponentIfMissing<ObiSoftbodySkinner>();
        bodySkinner.Source = softbodyInstance;
        bodySkinner.m_SkinningMaxDistance = 0.05f;

        IEnumerator bind = bodySkinner.BindSkin();
        while (bind.MoveNext()) { }

        foreach (var renderer in AdditionalRenderers)
        {
            var additionalSkinner = renderer.AddComponentIfMissing<ObiSoftbodySkinner>();
            additionalSkinner.Source = softbodyInstance;
            additionalSkinner.m_SkinningMaxDistance = 0.05f;

            IEnumerator additionalBind = additionalSkinner.BindSkin();
            while (additionalBind.MoveNext()) { }
        }

        softbodyInstance.transform.SetParent(BodyRenderer.transform);
        softbodyInstance.transform.localPosition = Vector3.zero;
    }

    private ObiSoftbodySurfaceBlueprint SetupBlueprint()
    {
        var blueprint = ScriptableObject.CreateInstance<ObiSoftbodySurfaceBlueprint>();

        // set the blueprint's particle radius and cluster radius:
        blueprint.inputMesh = BodyRenderer.sharedMesh;
        blueprint.surfaceSamplingMode = ObiSoftbodySurfaceBlueprint.SurfaceSamplingMode.Vertices;
        blueprint.surfaceResolution = 48;
        blueprint.GenerateImmediate();

        List<BoneWithThreshold> boneIndeces = new List<BoneWithThreshold>();
        for (int i = 0; i < BodyRenderer.bones.Length; i++)
        {
            for(int j=0; j < bonesThresholds.Count; j++)
            {
                if (BodyRenderer.bones[i].name.Contains(bonesThresholds[j].BoneName))
                {
                    boneIndeces.Add(new BoneWithThreshold()
                    {
                        BoneIndex = i,
                        Threshold = bonesThresholds[j].WeightThreshold
                    });
                }

            }
        }

        Mesh mesh = BodyRenderer.sharedMesh;

        HashSet<int> bonesParticles = new();

        for (int i = 0; i < mesh.vertexCount; i++)
        {
            BoneWeight boneWeight = mesh.boneWeights[i];
            for(int j=0; j < boneIndeces.Count; j++)
            {
                if(boneIndeces[j].BoneIndex == boneWeight.boneIndex0 && boneWeight.weight0 >= boneIndeces[j].Threshold ||
                    boneIndeces[j].BoneIndex == boneWeight.boneIndex1 && boneWeight.weight1 >= boneIndeces[j].Threshold ||
                    boneIndeces[j].BoneIndex == boneWeight.boneIndex2 && boneWeight.weight2 >= boneIndeces[j].Threshold ||
                    boneIndeces[j].BoneIndex == boneWeight.boneIndex3 && boneWeight.weight3 >= boneIndeces[j].Threshold)
                {
                    bonesParticles.Add(blueprint.vertexToParticle[i]);
                    var cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
                    cube.transform.localScale = Vector3.one * 0.01f;
                    cube.transform.position = BodyRenderer.transform.TransformPoint(mesh.vertices[i]);
                    cube.transform.SetParent(BodyRenderer.transform, true);
                }
            }
        }

        bool[] selectedParticles = new bool[blueprint.particleCount];

        for (int i = 0; i < blueprint.particleCount; i++)
        {
            if (bonesParticles.Contains(i))
            {
                selectedParticles[i] = false;
            }
            else
            {
                selectedParticles[i] = true;
            }
        }
        blueprint.distanceConstraintsData = new();
        blueprint.bendConstraintsData = new();
        blueprint.RemoveSelectedParticles(ref selectedParticles, true);
        var group = blueprint.AppendNewParticleGroup("chest");
        for (int i = 0; i < selectedParticles.Length; i++)
        {
            if (selectedParticles[i])
            {
                group.particleIndices.Add(i);
            }
        }

        return blueprint;
    }

}


Best regards,

Spartan190



Attached Files Thumbnail(s)
       
Print this item