Hey folks, I’ve got a feature idea that I’m having trouble finding a decent way to implement. I’d like to have particles act as sound waves for a game idea. Having the particles emit and collide/bounce around the area till they hit a character works great. I’d like the character that gets hit with a particle*(sound wave)* to be able to move towards the origin of the soundwave. The Particle Collider only gives me the object hit and the Particle that hit it, but neither of those have a way to find the origin of the Particle or even the position of the Emitter.
I theorized I could simply add an orgin variable to the particle class but I don’t have Unity Pro so that idea is out. Anyone have any theories on using the Particles system for this type of feature. I’m starting to think my best bet is to buy a Particle system from the Unity store which allows the spawning of a Game Object but I can’t guarantee those systems are as optimized or do Particle collisions as well as the Editors built in particles.
If sound waves bounce around the environment, you only know the direction of the sound you hear after its last reflection, which needn’t be where it originally came from. So it’s not the emitters position when the sound particle spawned, but the direction of the sound particle when it collided, as well as its intensity. At least, that’s how it works in real life, which might be far more complex than you want.
BDev, the GameObjects emitting the sounds won’t ever be the ones being hit by the sounds, unfortuantely.
Jasper, I might use something like you described. Simply use the particles direction and energy to determine what general direction the object hearing the sound should move towards.
If you’ve got the sendmessages checkbox on the worldparticlecollider checked it will send a message to the collider with the gameobject of the emitter.
Yup you’re right BDev. I mistakenly thought the OnParticleCollsion only had the individual particle object didn’t realize it has the game object that the particle emitter is attached to. Turned out to be super simple then. It’s not exactly where the particle came from depending on how long it takes to hit a character but it’s close enough for now.