Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Obi Fluid Collision Callback never ending
#1
Triste 
Im new to Obi and i have a problem with the collisions.

I have a flask which is generating a liquid(Obi Emiiter) and a floor (Obi Collider) that interacts with that liquid.
I made different floors each one with the PhLandController script that i only want to call when the liquid collides  with the floor
I also have an (Obi Solver) which have the following script.



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

[RequireComponent(typeof(ObiSolver))]
public class FluidPhCollisionHandler : MonoBehaviour {

    ObiSolver solver;
    PhLandController phController;

    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)
    {
        Oni.Contact contact = e.contacts[0];

        Component collider;
        if (ObiCollider.idToCollider.TryGetValue(contact.other,out collider)){
            phController = collider.GetComponent<PhLandController>();
            phController.increasePHLevel();
        }
    }



}

The problems is that after i remove the liquid from colliding to the floor the method increasePHLevel() is call infinitly.
The only way to stop it is that the liquid begins a new collision with a different floor but the problem is now pass to the new floor method is call infinitly.


Any suggestion how i could fix this ?

Thanks
Reply


Messages In This Thread
Obi Fluid Collision Callback never ending - by RjcArci - 29-09-2019, 11:40 PM