Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ParticleCollisionEvent OnParticleCollision
#1
Hi there,

i was wondering, how to create an ParticleCollisionEvent in a OnParticleCollision function. 
I can get the Particle collision via this function.
But i am not sure, how to build an ParticleCollisionEvent from this. Or how to get the Info from the collision from the code below.

My goal is to get aVector3 Intersection of the Collision, and the normal Sonrisa

void Solver_OnCollision(object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
    {
        for (int i = 0; i < e.contacts.Length; ++i)
        {
            if (e.contacts[i].distance < 0.001f)
            {
                Component collider;
                if (ObiCollider.idToCollider.TryGetValue(e.contacts[i].other, out collider))
                {
                }
 
            }
        }
    }

thx for any help Sonrisa

I actually got that to work, I used 
e.contacts[i].point as the intersect Point
e.contacts[i].normal as the normal
(pretty obvious Lengua)

Now i just ran into another Problem. The OnParticleCollision triggers quite often, but I would rather like it to trigger it only on the first collision. What would be a good approach to achieve that behaviour?

Thx in regards,
A ObiFluid - Noob
Reply


Messages In This Thread
ParticleCollisionEvent OnParticleCollision - by UTFLuke - 29-01-2018, 03:46 PM