I’m having trouble with my particle collisions. They seem to happen much less frequently than it would seem they should. In [this picture][1], the system has an emission rate of 100 and has been emitting for a few seconds already, but the collision detection has only registered three hits.
Here’s my code for the particle system:
using UnityEngine;
using System.Collections;
public class SprayGun : MonoBehaviour {
public float freezeDecrement = 10.0f;
private ParticleSystem prtSys;
private CharacterInput scriptCharInput;
void Start()
{
prtSys = GetComponent<ParticleSystem>();
scriptCharInput = GameObject.Find("Character").GetComponent<CharacterInput>();
}
void OnParticleCollision(GameObject other)
{
ParticleSystem.CollisionEvent[] colEvents = new ParticleSystem.CollisionEvent[prtSys.safeCollisionEventSize];
int numCollisionEvents = prtSys.GetCollisionEvents(other, colEvents);
for (int i = 0; i < numCollisionEvents; i++)
{
if (colEvents*.collider.name == "Character")*
{
scriptCharInput.xTransferEnergy -= freezeDecrement * Time.deltaTime;
print(“BOOM”);
}
}
}
}
Any ideas? Does it have anything to do with using World (currently selected) vs Plane collision? I couldn’t find any good documentation explaining the difference.
[1]: http://img820.imageshack.us/img820/1989/xhvv.png