Latest Threads |
can you remove particles ...
Forum: Obi Softbody
Last Post: aardworm
Yesterday, 07:09 AM
» Replies: 0
» Views: 29
|
ObiRope Mesh Renderer
Forum: Obi Rope
Last Post: quent_1982
08-07-2025, 11:27 AM
» Replies: 4
» Views: 154
|
How to dynamically change...
Forum: Obi Rope
Last Post: quent_1982
08-07-2025, 06:34 AM
» Replies: 6
» Views: 300
|
Pipeline that bends
Forum: Obi Softbody
Last Post: josemendez
04-07-2025, 09:52 AM
» Replies: 13
» Views: 1,028
|
How to implement/sync Obi...
Forum: Obi Rope
Last Post: quent_1982
01-07-2025, 01:48 PM
» Replies: 2
» Views: 250
|
Collisions don't work con...
Forum: Obi Rope
Last Post: chenji
27-06-2025, 03:05 AM
» Replies: 3
» Views: 332
|
Force Zone apply differen...
Forum: Obi Rope
Last Post: chenji
26-06-2025, 11:41 AM
» Replies: 11
» Views: 954
|
Can I blend in and out of...
Forum: Obi Cloth
Last Post: josemendez
24-06-2025, 04:42 PM
» Replies: 3
» Views: 309
|
Using a rigidbody/collide...
Forum: Obi Cloth
Last Post: josemendez
24-06-2025, 09:29 AM
» Replies: 1
» Views: 187
|
Solver is too performance...
Forum: Obi Rope
Last Post: quent_1982
20-06-2025, 08:09 AM
» Replies: 40
» Views: 4,803
|
|
|
How make slow disappearing puddle? |
Posted by: Andrew - 13-03-2019, 08:20 AM - Forum: Obi Fluid
- Replies (2)
|
 |
Can i make slow disappearing puddle, by decrease radius of each particle witch collide with the floor? I try to change the size of particle by Obi Particle Renderer, but it scale all rendered particles. And new flow of water affect old one. Or exists some method to split particles and change scale of each groups by Obi Particle Renderer.
|
|
|
Cloth/solver is running faster then intended |
Posted by: drorlazar - 12-03-2019, 01:28 PM - Forum: Obi Cloth
- Replies (1)
|
 |
Hi
I've assigned obi cloth to both pants and shirt of my character, once i've add the 2nd cloth the solver is running too fast (twice as fast as it intended).
i've tried assigning each to a seperate solver, but this cancel one of the cloths (pants, that was created 1st)
any ideas?
|
|
|
How to fasten trousers |
Posted by: Richard - 09-03-2019, 11:33 PM - Forum: Obi Cloth
- No Replies
|
 |
Hello.
I would like to fasten trousers to fit human body. I thought using direction vector. Is there another better way?
|
|
|
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);
}
}
}
}
|
|
|
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 improved
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
|
|
|
|