Search Forums

(Advanced Search)

Latest Threads
Simple Collision Debug Lo...
Forum: Obi Fluid
Last Post: PortableAnswers
5 hours ago
» Replies: 0
» Views: 4
Stitcher breaks simulatio...
Forum: General
Last Post: Qriva0
23-01-2026, 12:47 PM
» Replies: 3
» Views: 1,924
(7.0.3) Updating skin con...
Forum: Obi Cloth
Last Post: josemendez
23-01-2026, 09:11 AM
» Replies: 3
» Views: 267
Extending rope by pulling...
Forum: Obi Rope
Last Post: trentthebaker
09-01-2026, 03:58 PM
» Replies: 0
» Views: 254
Managing dynamic constrai...
Forum: General
Last Post: josemendez
09-01-2026, 09:54 AM
» Replies: 1
» Views: 386
Emit rope like silly stri...
Forum: Obi Rope
Last Post: josemendez
09-01-2026, 09:17 AM
» Replies: 8
» Views: 1,029
Non-uniform particle dist...
Forum: Obi Rope
Last Post: chenji
09-01-2026, 02:56 AM
» Replies: 11
» Views: 4,334
Setting velocity to 0
Forum: Obi Cloth
Last Post: Qriva0
22-12-2025, 11:26 AM
» Replies: 7
» Views: 1,317
Cloth backside collision ...
Forum: Obi Cloth
Last Post: Qriva0
19-12-2025, 10:07 AM
» Replies: 7
» Views: 2,302
Following Seas - Made wit...
Forum: Made with Obi
Last Post: josemendez
19-12-2025, 09:56 AM
» Replies: 1
» Views: 429

 
  How to destroy particle from it's position
Posted by: anonymous - 09-03-2019, 03:48 PM - Forum: Obi Fluid - Replies (3)

Hi.

I need particles to be killed once they are below a given position.y
In my situation, the particles should live as long as they don't fall below some position. Once enough are killed, new ones would be emitted.

Here's my code for now but something is not right. It finds the particle pos but the kill part does not seem to work because my active particle number (in the emitter inspector)  stays the same when running. If possible, I would like also something less demanding than having to regularly loop through the array to do the pos check. 

Code:
  IEnumerator PurgeParticlesTooLow()
   {
       while(true)
       {
           yield return new WaitForSeconds(5);

           Vector4 v4;
           for (int i = 0; i < obiSolver.positions.Length; ++i)
           {
               v4 = obiSolver.positions[i];
               print("pos particle: " + v4);
               if (v4.y <= GlobalVars.cstBallBreakPointY)
               {
                   obiEmitter.life[obiSolver.particleToActor[i].indexInActor] = 0;
                   print("killed particle at pos: " + v4);
               }
           }

       }
   }

Print this item

  Flickering - solvers effect each other
Posted by: shayk - 09-03-2019, 11:11 AM - Forum: Obi Fluid - Replies (2)

Hi All,
First of all - I have to say that i really like this product, simulations are very realistic, fast, configurable - well done! (documentation could be improvedSonrisa

using unity 2018.2.1f1 
using Obi 4.0.2

My real scene is a little complex with many moving solvers/emitters, so I built a simple demo scene to demonstrate the problem.
In general: fluid stream collide with a sphere, collided particles are being killed, and for every killed particle a new particle is emitted from a local emitter on the sphere

The demo scene includes the following GameObjects/Components:
1)MainSolver - Empty with a solver (global space) and a script MainCollisionDetection(described bellow)
(solver constraints copied from Obi sample scene "FluidViscosity")
2)MainEmitter - Empty with an ObiEmitter (that uses MainSolver as its solver) and particle renderer
  emitter properties: speed: 5, emitter material: Honey, collision material :very sticky
3)Sphere - unity sphere with ObiCollider ,RB, and ObiRB
  a)SphereSolver - child of Sphere - Empty with a solver (local space)
    (solver constraints copied from Obi sample scene "FluidViscosity")
    1. SphereEmitter - child of SphereSolver - empty with an ObiEmitter (that uses SphereSolver as its solver) and particle renderer
       emitter properties: speed: controlled by script SphereEmitionControl (described bellow), emitter material: Honey, collision material :very sticky 

4)MainCollisionDetection script detects collisions (on MainSolver), kills the hitting particle, and adds the particle collision data to a queue in the SphereEmitionControl script

Code:
using System.Collections.Generic;
using UnityEngine;
using Obi;

public class MainCollisionDetection : MonoBehaviour {

   public ObiEmitter mainEmitter;
   ObiSolver solver;

   Obi.ObiSolver.ObiCollisionEventArgs frame;
   List<int> allreadyEmittedParticles;

   void Awake()
   {
       solver = GetComponent<Obi.ObiSolver>();
   }

   void OnEnable()
   {
       solver.OnCollision += Solver_OnCollision;
   }

   void OnDisable()
   {
       solver.OnCollision -= Solver_OnCollision;
   }
   
   void Solver_OnCollision(object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
   {
       frame = e;
       if (solver == null || frame == null || frame.contacts == null) return;

       allreadyEmittedParticles = new List<int>();
       int closeContacts = 0;

       for (int i = 0; i < frame.contacts.Count; ++i)
       {
           
           if (frame.contacts[i].distance < 0.001f)
           {
               Component contactColl;
               ObiCollider.idToCollider.TryGetValue(frame.contacts[i].other, out contactColl);

               if (contactColl != null)
               {
                   ObiSolver.ParticleInActor pa = solver.particleToActor[frame.contacts[i].particle];
                   ObiEmitter emtr = pa.actor as ObiEmitter;
                   int particleIndexInEmitter = pa.indexInActor;

                   if (!allreadyEmittedParticles.Contains(particleIndexInEmitter))
                   {
                       allreadyEmittedParticles.Add(particleIndexInEmitter);
                       closeContacts++;

                       Vector3 point = frame.contacts[i].point;
                       Vector3 normal = frame.contacts[i].normal;

                       //kill hit particle in the main emitter
                       emtr.life[particleIndexInEmitter] = 0;

                       //look for the hitted collider emitter
                       ObiEmitter colliderEmitter = contactColl.GetComponentInChildren<ObiEmitter>();
                       
                       if (colliderEmitter != null)
                       {
                           SphereEmitionControl sphereEmitionControl = colliderEmitter.GetComponent<SphereEmitionControl>();

                           //add particle to collider emitter queue
                           sphereEmitionControl.AddParticleToEmit(point, Quaternion.Euler(normal));
                       }
                   }
               }  
           }
       }
   }
}

5)SphereEmitionControl script has a queue of particles positions/normals, it is filled only by data from MainCollisionDetection script.  The script repeatedly checks if the queue is not empty, it dequeues the data, move its transform to the stored position/normal and emit for a short while (i didn't know how to emit one particle so i timed the emittion with a coroutine)
Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Obi;


public class ParticleToEmit
{
   public Vector3 pos;
   public Quaternion localRot;
}

public class SphereEmitionControl : MonoBehaviour {

   ObiEmitter m_emitter;
   bool emitting;
   Queue<ParticleToEmit> particlesToEmit;

   void Start()
   {
       m_emitter = GetComponent<ObiEmitter>();
       m_emitter.speed = 0f;
       particlesToEmit = new Queue<ParticleToEmit>();
   }

   void LateUpdate()
   {
       if (particlesToEmit.Count > 0 && !emitting)
       {
           ParticleToEmit par = particlesToEmit.Dequeue();
           transform.position = par.pos;
           transform.localRotation = par.localRot;
           StartCoroutine(ColliderEmitterEmit());
       }
   }

   //add a particle data to queue
   public void AddParticleToEmit(Vector3 pos, Quaternion localRot)
   {
       ParticleToEmit newParticle = new ParticleToEmit();
       newParticle.pos = pos;
       newParticle.localRot = localRot;
       particlesToEmit.Enqueue(newParticle);
   }

   //emit particle
   public IEnumerator ColliderEmitterEmit()
   {
       emitting = true;
       
       m_emitter.speed = 1f;
       m_emitter.EmitParticle(0);

       yield return null;
       
       m_emitter.speed = 0f;

       emitting = false;
   }
}


Regarding the collisions the scripts run OK , the problem is : the particles (emitted from SphereEmitter) are flickering.
I did some testing and found that:
case a: while running - if i disable the MainSolver (in the editor) the flickering stops (strange, it should not effect the scene because the particles belong to the SphereSolver)
case b: while running - if the MainSolver is enabled, and i disable and than enable the SphereSolver - flickering stops, and everything works well as expected, but now if i disable and than enable the MainSolver, flickering starts again

why does the flickering happen?
how to prevent it?

thanks,
shayk

Print this item

  liboni can't be found in linux editor [solved]
Posted by: captainboothat - 09-03-2019, 02:37 AM - Forum: Obi Rope - No Replies

I'm using the linux version of unity and it keeps having problems finding liboni.  The .dll and .so are in obi->plugins->x86_64

[Solved]
Seems unity is expecting to find this lib in /home/$user/Unity/Hub/Editor/2018.3.5f1/Editor/Data/Mono/lib/. Once liboni.so was placed in there it stopped complaining and obi now works.  You'll also have to remove obi/plugin/x86_64/liboni.so or it bitches there's two versions of the lib.  Not sure yet if this effects building the game or not.

Plopping this thread so future users can find it.

Print this item

  Extending rope in a particular way
Posted by: TaliaKuznetsova - 07-03-2019, 06:22 PM - Forum: Obi Rope - No Replies

Ao I recently got obi-rope and so far like what I see but I'm not sure how to use it for what I want. One vehicle is going to have a winch and i need to have it so the player can pull the cable out via hook and carry it with them with the cable extending as they pull out and not auto feed out. My first plan was to physically wrap the cable around the drum like real life and set motor to free spool so when the player tugs the rope it unspools but that seems intensive unless obi rope can handle that no problem. 

My second solution was to attach the rope to the end of the winch body and have it extend when it's being tugged on and the player has the hook in their hand.

Any ideas on the matter? The first option would be ideal as maximum realism is my goal if there is a good way to do that without high cpu useage.

Print this item

  Could you help me? how to config this
Posted by: jirawatball - 07-03-2019, 11:10 AM - Forum: Obi Rope - No Replies

I need to do this but I don't Know how to config this

https://www.picz.in.th/image/tftWXu

https://www.picz.in.th/image/tft0zZ

Print this item

  get sign when cloth is tore
Posted by: Richard - 07-03-2019, 10:20 AM - Forum: Obi Cloth - Replies (17)

Hello.

I want to make if statement when the cloth is tore. How can I do that?

Print this item

Lengua Are Obi products going to be updated soon?
Posted by: StudioTatsu - 07-03-2019, 05:16 AM - Forum: General - Replies (5)

Hi, 

1. I'm wondering if the Obi products will be updated (with bug fixes) on the Unity Asset store soon. Several bug fixes are floating around on the forums that I constantly have to hunt down and add when creating new projects using Obi Assets. 


2. Would you create a video on how to control a softbody ball with a rigidbody - that actually collides with the floor
I think I'm doing something wrong or missing a step. Every time I attempt it, the ball simply falls thru the floor. 

Thanks

Print this item

Pregunta Assertion failed on expression: 'offset + size <= bufLen'
Posted by: azevedco - 06-03-2019, 04:50 PM - Forum: Obi Cloth - Replies (6)

Hi,

Followed the quick setup guide.  Brought in an Obi Solver into the scene, set a child object with a Skin Mesh Renderer up with the Obi Cloth Component (along with it's additional components all left as default), then clicked initialize.

After hitting play, I get slammed with this error message:

Assertion failed on expression: 'offset + size <= bufLen'

Over and over again.  Everything in the setup was not really modified a part from bringing in the appropriate data for setting up the Game Object.  Has anyone had to deal with this issue and/or know how to deal with it?

I've brought just the Model into a scene and set it up, got the error message when it's simulating.  In our main scene, as soon as the character is to animate through a Timeline, the character freezes up and the child object on the character isn't getting affected by the Obi Cloth.

Thanks,
Cole

Print this item

  add vector to obi cloth
Posted by: Richard - 05-03-2019, 03:50 PM - Forum: Obi Cloth - Replies (5)

Hello.
I try to add vector to obi cloth. I have a error:Cannot implicitly convert type 'UnityEngine.Vector3' to 'float', but the direction of coding is not problem?

using UnityEngine;
using System.Collections;
using Obi;

[RequireComponent(typeof(ObiActor))]
public class DistanceAnchor : MonoBehaviour
{

    ObiActor actor;
    public ObiSolver solver;
    


    void Awake()
    {
        actor = GetComponent<ObiActor>();

    }

    void Update()
    {
        ObiSolver solver = actor.Solver;

        float invMassPerParticle = 0.01f;
        for (int i = 0; i < actor.invMasses.Length; ++i)
        {
            int indexInSolver = actor.particleIndices[i];
            actor.invMasses[i] = solver.invMasses[indexInSolver];
            actor.invMasses[i] = new Vector3(0.0f, 0.05f, 0.0f);
            
        }
    }
}

Print this item

  Sticky Materials
Posted by: Kostik3000 - 05-03-2019, 03:34 PM - Forum: Obi Softbody - Replies (3)

Hi there,

yesterday I purchased your Softbody unitypackage. I am trying to stick two objects together (like in your example on the website with the cloth). 

I created a sticky material and applied it to two spheres, which have soft bodies on them. But the don't stick to each other.

The obi solver has Collision and Particle Collision checked true. I also tried adding collideres to the spheres, but that changes nothing.

Am I missing something? Any help will be appreciated.

Print this item