Search Forums

(Advanced Search)

Latest Threads
Problem with softbody and...
Forum: Obi Softbody
Last Post: aardworm
7 minutes ago
» Replies: 8
» Views: 3,650
How can I detect my secon...
Forum: Obi Rope
Last Post: josemendez
29-03-2025, 05:24 PM
» Replies: 6
» Views: 247
Obi 7 disable simulation
Forum: Obi Rope
Last Post: natko1412
28-03-2025, 11:21 AM
» Replies: 6
» Views: 289
Reduce particles after bl...
Forum: Obi Softbody
Last Post: josemendez
25-03-2025, 08:11 AM
» Replies: 1
» Views: 113
Pinholes: new component f...
Forum: Announcements
Last Post: josemendez
24-03-2025, 09:17 AM
» Replies: 7
» Views: 627
unity6 errors
Forum: Obi Rope
Last Post: josemendez
23-03-2025, 08:26 PM
» Replies: 1
» Views: 147
Settings Obi Skinned Clot...
Forum: Obi Cloth
Last Post: cgwill
22-03-2025, 09:02 PM
» Replies: 0
» Views: 82
Growing a rope attached t...
Forum: Obi Rope
Last Post: josemendez
18-03-2025, 07:39 AM
» Replies: 1
» Views: 206
2 Rendering bugs on iOS(M...
Forum: Obi Fluid
Last Post: cliv3dev
17-03-2025, 02:30 PM
» Replies: 2
» Views: 260
Twisted Bones
Forum: Obi Rope
Last Post: Jawsarn
15-03-2025, 10:35 PM
» Replies: 0
» Views: 115

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

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

  [Fixed] ProceduralInstanced.shadergraph build error on Unity 6
Posted by: marzand - 14-03-2025, 06:07 PM - Forum: General - No Replies

I encountered an error on building my project in Unity 6000.0.0.41f. 

in ObiMaterials/Common/Instanced/Compute/ProceduralInstanced.shadergraph:

Code:
'SampleShadow_ComputeSamples_Tent_5x5': cannot convert output parameter from 'min16float[9]' to 'float[9]'
Compiling Subshader: 0, Pass: ShadowCaster, Vertex program with PROCEDURAL_INSTANCING_ON SHADOWS_DEPTH
Platform defines: SHADER_API_DESKTOP UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_REFLECTION_BUFFERS UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_PASS_SHADOWCASTER UNITY_PBS_USE_BRDF1 UNITY_PLATFORM_SUPPORTS_DEPTH_FETCH UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_UNIFIED_SHADER_PRECISION_MODEL UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS
Disabled keywords: INSTANCING_ON SHADER_API_GLES30 SHADOWS_CUBE UNITY_ASTC_NORMALMAP_ENCODING UNITY_COLORSPACE_GAMMA UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_VIRTUAL_TEXTURING _CASTING_PUNCTUAL_LIGHT_SHADOW

The fix was easy enough to find. Turns out in the graph, the position input node has its precision set to single, while the other nodes are set to inherit. Setting it to inherit fixes the mismatched precision issue.

Print this item

  2 Rendering bugs on iOS(Metal)
Posted by: cliv3dev - 14-03-2025, 03:42 PM - Forum: Obi Fluid - Replies (2)

Hi,



I am reporting 2 rendering bugs for Obi Fluid on iOS.



Unity 2022.3.60

URP or SRP

iOS v18.3.2

iOS SDK: 18.2

Obi Fluid [7.0.5]

Solver backend: Compute (GPU) and Burst(CPU)

Test scene: FluidViscosity



When running on iOS, 

1. test scene with Burst backend, there is a black color issue in the transparent fluid rendering (same bug in SRP or URP), see screenshot 20250314_135736000_iOS.png


2. test scene with Compute backend, fluid rendering starts with the same look as Burst and with same black color bug but after 2 or 3 seconds, the fluid mesh explodes, see screenshot 20250314_140447000_iOS.png



I built on PC (DX11) and Meta Quest (Vulkan), and the rendering presents no bug at all : com.oculus.vrshell-20250314-153625.jpg



So, seems to be an issue with Metal API...

Hope this helps !



Attached Files Thumbnail(s)
           
Print this item

  How to fix both ends when using bones for a ObiRope?
Posted by: kodra - 14-03-2025, 10:57 AM - Forum: Obi Rope - Replies (3)

As this example in document shows, ObiRope can be fixed on both ends, leaving only the middle part free.

But I can't figure out how to integrate with a character with bone hierarchy. For example, in this example the dragon's tail is made of 12 bones. In this case, how to make only the first (root) and last (tip) bones follow a predefined animation, while let the middle part solved by Obi?

I guess I need to use an attachment, but I'm not sure how to set it up with bones...

Print this item