- Home /
Shuriken Collision Detection
I have been trying to find info or documentation on the supposed collision callbacks for shuriken particles introduced in 4.2.
I'm trying to make a "tractor beam" of particles so to speak and I want to detect when that object is in the stream of particles--detecting game object collision with the particles seems like a solid start. This was only added into Shuriken with 4.2 supposedly but I can't figure out how to use this feature.
Any help with this or the tractor beam would be awesome. I've thought about generating a mesh or line trail between the points the tractor beam is pointing at but it just isn't working.
Alternatively I have tried detecting the distance between the item I'm looking to detect in the beam and the particle itself:
int length = particleSystem.GetParticles(particles);
bool setBeam = false;
for(int i = 0; i < length; i++) {
if(Vector3.Distance(particles[i].position, player.position) < distThreshold)
setBeam = true;
}
print (setBeam);
player.gameObject.GetComponent<DetectTractorBeam>().inBeam = setBeam;
Cheers!