Search Forums

(Advanced Search)

Latest Threads
ObiRope Mesh Renderer
Forum: Obi Rope
Last Post: quent_1982
1 hour ago
» Replies: 4
» Views: 40
How to dynamically change...
Forum: Obi Rope
Last Post: quent_1982
6 hours ago
» Replies: 6
» Views: 154
Pipeline that bends
Forum: Obi Softbody
Last Post: josemendez
04-07-2025, 09:52 AM
» Replies: 13
» Views: 823
How to implement/sync Obi...
Forum: Obi Rope
Last Post: quent_1982
01-07-2025, 01:48 PM
» Replies: 2
» Views: 199
Collisions don't work con...
Forum: Obi Rope
Last Post: chenji
27-06-2025, 03:05 AM
» Replies: 3
» Views: 266
Force Zone apply differen...
Forum: Obi Rope
Last Post: chenji
26-06-2025, 11:41 AM
» Replies: 11
» Views: 779
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,289
Obi 7 Model Scaling
Forum: Obi Cloth
Last Post: alkis
19-06-2025, 02:37 PM
» Replies: 2
» Views: 260

 
Exclamación Obi adding huge forces to rigidbodies when you delete ropes... (Repro project)
Posted by: Hatchling - 19-05-2021, 04:49 PM - Forum: Obi Rope - Replies (8)

So, this time I found that when you delete ropes, it can cause NaNs and absurd velocity assignments to rigidbodies when you destroy a rope's GameObject.

The repro package can be found here: (Expires in 30 days)
https://ufile.io/45i4log9

To reproduce:

  1. Start a new Unity project (I'm using 2020.2.0f1).
  2. Add Burst (version 1.4.8) and Jobs (version 0.8.0-preview.23) through the Package Manager.
  3. Import the package linked above.
  4. Open SampleScene.unity and press Play.
  5. Click and drag to attach a rope. The point where you click (mouse down) will be the first point where a rope gets attached. The point where you let go (mouse up) will be the second point where a rope gets attached. Add several ropes.
  6. Press [R] to delete all of the ropes you created.
  7. Repeat 4 and 5 until the bug is reproduced.
You'll see this when you reproduce the bug:
  • The rigidbodies in the scene may start behaving abnormally, with ghost forces pushing them around even though all of the ropes have been removed.
  • You'll see errors spamming the console regarding invalid forces being applied to one or more of the rigidbodies. For example: rigidbody.velocity assign attempt for 'Floating Platform' is not valid. Input velocity is { 2.468001, NaN, 55.692116 }.
  • Some of the rigidbodies may explode into outer space from the absurd forces.
Seems related to the previous bug I posted, with very similar symptoms.

Other symptoms I've noticed in fighting with this bug:
  • When I start SampleScene with a rope in the scene already, (drag ObiPrefabs/Rope into the scene and activate the GameObject before pressing play) any ropes you add to the scene will be frozen and will not simulate.
  • After reproducing the above bug: When switching to the scene "RopeNet" (which uses a modified example script to use the global solver), pressing play, and then unpressing play, the console will spam about some phantom Obi.ObiLateFixedUpdater trying to poke at various destroyed Obi components. When this occurs, you'll find that there are no ObiLateFixedUpdater instances visible in the hierarchy.
Code modifications to note:
  • ObiStatic.cs added, which enables a global solver.
  • ObiStaticSettings.cs added, which allows you to define the global solver using a prefab reference.
  • When an ObiRope is created, it will check for a solver in one of its ancestors. If one isn't found, it'll use ObiStatic.WorldSolver, which will get instantiated if needed.
  • RopeNet.cs will use ObiStatic.WorldSolver instead of creating its own solver.

Print this item

  Obi Fluid's Buildup Substance, can we hide it?
Posted by: LiegeOfAnima - 17-05-2021, 05:10 AM - Forum: Obi Fluid - Replies (3)

I built a Honey substance feature using Obi Fluid, however I was being bothered by this buildup substance on the top of the sphere I was emitting the honey on it and have it dripping off at the bottom. is there a way to have the buildup hidden?



Attached Files Thumbnail(s)
   
Print this item

Pregunta How to query Obi geometry with raycasts?
Posted by: Hatchling - 15-05-2021, 06:57 AM - Forum: Obi Rope - Replies (15)

Does Obi provide the ability to query the geometry of Obi Actors, like how Physics.Raycast, .Spherecast, etc. allows you to query colliders?

I'm assuming that most of the math involved for this has already been done somewhere in there in order to support collision detection.


I see there is ObiParticlePicker, but it seems like this approach isn't optimal:
  • Only allows picking particles directly, instead of by their collision geometry (simplexes)
  • Doesn't return a point on the surface that the ray first made contact
  • Doesn't query the particle grid to filter out most of the tests
  • Isn't written in efficient threaded code in the same way that other collision checks are
  • Only considers one solver
  • Cannot be invoked in a static way (like Physics.Raycast)
If I were more familiar with how to interface with the internal stuff of Obi, I'd be willing to write these queries myself. An interesting idea might be to provide some sort of base query class where you can implement custom queries (for example, getting the closest point on a simplex to the query point, within a certain radius (or infinite radius)). If I wrote something like this, I'd be willing to share the code with the hope that it'd be maintained as Obi is developed.

A global query would probably follow this procedure:
  1. Test the query condition against the oriented bounding box of each solver. If a given solver passes, then...
  2. Test the query condition against all occupied cells, OR, in cases where it is possible to determine which cells pass the query condition without enumerating through each cell, get a list of cells that pass the query condition. If a given cell passes, then...
  3. Test the query condition against all simplexes occupying the cell.
  4. For each simplex that passes the query condition, modify the query result.
    • In the case of a Raycast, replace the current hit point if its distance from the ray is closer. 
    • In the case of a RaycastAll, add the hit point to the list of hit points.
    • In the case of a Checksphere (which returns true if any object occupies a spherical volume, otherwise false), terminate the query and return "true" as the query result if and when a simplex passes the query condition, otherwise false. (A similar test could be done on the cell/solver bounding box itself if it is fully contained within the Checksphere volume.)
A solver specific query would be similar, sans step 1.

I'm guessing that it'd be wasteful to redo all of the work involved in calculating queries like these, given that collision tests between line simplexes and other types are already possible. (A line simplex can be treated like a raycast or a spherecast, with minor modifications.)

Print this item

  mix two fluids
Posted by: GinHuang - 15-05-2021, 06:11 AM - Forum: Obi Fluid - Replies (4)

When I tried to mix two fluids,The particles will explode and fly around. Is it currently impossible to mix liquids in this way?


   

Print this item

Pregunta How does one disable "phase" based collision masking?
Posted by: Hatchling - 15-05-2021, 01:57 AM - Forum: Obi Rope - Replies (6)

I'd like to ensure that, in my project, everything is able to collide with everything else. However, each time I instantiate a rope, it has the same phase as the last rope I instantiated.

I'd like to disable this feature, as going in and editing each rope I instantiate to have a unique phase seems like it'd be a real pain.

Is there a way to do this? Or would I need to modify source code I don't have access to (e.g. in the DLL)?

EDIT: It appears that using self-collision doesn't just allow collision with the self, but also allows collision between *everything else* of the same phase, *except* rigidbodies, which mostly solves the problem: Just make sure everything has "Self Collision" enabled and that every particle actor uses phase 1, and every rigidbody uses phase 0.
The description is a bit misleading. (Also, as a side note, the term "phase" doesn't evoke the concept of collision. Usually phase is used to describe something's progress through a cycle, like rotation. Perhaps "layer" would be a better term.)

Print this item

  Dynamic Grappling hook rope length?
Posted by: MikaleM - 14-05-2021, 04:29 AM - Forum: Obi Rope - Replies (1)

Currently in my game i have a character who uses momentum to throw a grappling hook object. As soon as the character throws the hook i enable the obirope mesh and set pin constraints on the hand and the bottom of the hook. I would like for the rope to dynamically change length in relation to the velocity of the hook. But the rope restrains the grappling hook from flying flying in a normal arc. I have been using pin constraints akin to the grappling hook sample scene instead of particle attachments. I have tried to use both static and dynamic particle attachments but this causes the rope to not attach properly to the hand and grappling hook. how can i change the length of the rope as the grappling travels without  affecting the path, (but without static attachments because i'd like for the rope and grappling hook to interact eventually)                                                                                                                            also loving obirope so far. just wish i could figure this out. Interesante



Attached Files
.cs   ObiRopeSpawn.cs (Size: 4.31 KB / Downloads: 7)
.gif   gancho.gif (Size: 79.34 KB / Downloads: 18)
Print this item

  softBody velocity
Posted by: ReaperQc - 14-05-2021, 02:17 AM - Forum: Obi Softbody - Replies (5)

Hi, I am trying to get access to the velocity of my softbody because i can switch between multiple character with different controls. some use rigidbody and one use the softbody, when i switch from the rigidbody to the softbody, i can apply a force to the softbody that is the same as the last velocity of my rigidbody before switching, but when i try to switch from the softbody to a rigidbody, i would like to get the last velocity of my softbody and apply it to the rigidbody's velocity,  but unfortunately,I am unsure where to access the softbody's velocity, i was able to find the solver's velocities but it return an unusable vector4 that is only usable with obi element.

Print this item

  Tear after changing length with cursor
Posted by: luvjungle - 13-05-2021, 02:37 PM - Forum: Obi Rope - Replies (5)

Hi all!
Is it possible to tear after changing length?
Here is my code for tearing:

Code:
    void Solver_OnCollision(object sender, ObiSolver.ObiCollisionEventArgs e)
    {
        var world = ObiColliderWorld.GetInstance();

        // just iterate over all contacts in the current frame:
        foreach (Oni.Contact contact in e.contacts)
        {
            // if this one is an actual collision:
            if (contact.distance > 0.01) continue;

            ObiColliderBase col = world.colliderHandles[contact.bodyB].owner;
            TearRope(col, contact);
        }
    }

    private void TearRope(ObiColliderBase col, Oni.Contact contact)
    {
        if (!col || !col.CompareTag(StaticData.tear)) return;

        ObiSolver.ParticleInActor pa = solver.particleToActor[contact.bodyA];
        if (pa == null) return;

        var actor = pa.actor as ObiRope;
        if (!actor) return;
       
        if (pa.indexInActor >= actor.elements.Count) return;

        actor.Tear(actor.elements[pa.indexInActor]);
        actor.RebuildConstraintsFromElements();
    }

It works for pre-created rope, but when I change length, it cuts somewhere at the end, not at collision point.
Please help.

Print this item

  Export Obi Cloth Simulation as Alembic File
Posted by: orestissar - 13-05-2021, 01:28 PM - Forum: Obi Cloth - Replies (7)

Hello there,

I have a scene with a human avatar wearing a shirt(the garment is divided in separate parts like: front/back torso, sleeves etc). I have succesfully created (you helped me in another thread !) a script that creates all obi components and adds them to the Shirt. 

Everything is working fine so far. 

Using the Alembic library from the package manager, im able to export the scene into an alembic format.

However, when i load and play  the new alembic object in the scene the shirt dissapears in the alembic animation after a while. I tried to export the same avatar/shirt before adding the OBI components and in this case the alembic animation works fine. What i mean is that when the shirt is OBI, it dissapears from the alembic.

Do you possibly have any idea/solution of why this happens?

Thanks a lot beforehand!

Print this item

  Deactivating the obi solver when not needed ?
Posted by: VincentAbert - 13-05-2021, 01:07 PM - Forum: Obi Rope - Replies (12)

Hello,

Let's say I have a level which only features ropes in one or two rooms. Trying to mitigate all my performance overhead, I would like to disable simulation when not needed, what is the best way to do that ?
I tried disabling the updater and solver, and activating them when the player enters a trigger, but it causes a lag spike, probably because of some initialization. What would be the best way to go about this ?

Thank you,

Vincent.

Print this item