29-01-2018, 03:46 PM
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
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
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 )
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
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
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
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 )
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