05-09-2022, 01:04 PM
Hi
i am trying to find out the number of particles of water passing through a collider.
Emitter produces 400 particulate water. Even if the collider touches all of them, the count remains around 200.
http://obi.virtualmethodstudio.com/manua...sions.html I looked here but I don't understand
https://imgur.com/a/if0G3bu
i am trying to find out the number of particles of water passing through a collider.
Emitter produces 400 particulate water. Even if the collider touches all of them, the count remains around 200.
http://obi.virtualmethodstudio.com/manua...sions.html I looked here but I don't understand
https://imgur.com/a/if0G3bu
PHP Code:
ObiSolver solver;
[SerializeField] int counter = 0;
void Awake()
{
solver = GetComponent<ObiSolver>();
}
void OnEnable()
{
solver.OnCollision += Solver_OnCollision;
}
void OnDisable()
{
solver.OnCollision -= Solver_OnCollision;
}
void Solver_OnCollision(object sender, Obi.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)
{
ObiColliderBase col = world.colliderHandles[contact.bodyB].owner;
if (col != null && col.gameObject.layer == 7)
{
// do something with the collider.
counter=solver.contactCount;
}
}
}
}