For example, flamethrower or acid puke (lets assume that the particle simulation is in World space, so the trigger collider of constant shape isnt an option). Is OnParticleCollision method good enough from optimization standpoint? Or I need to write some custom solution?
I’ve been told that for stuff like this a lot of games developers use empty gameobjects, so here’s what I’d do, get the particle effect as normal without any world particle colliders unless you want that there to be fancy and then parent an empty gameobject to it with a perhaps a capsule collider or a sphere collider and get them the shape of a cone to match your particle effect.
Then when that empty instantiates or activates with your particle effects it should all work, if you want the acid for example to act like a projectile I recommend putting in more individual particles and then having them attach to an empty gameobject with a rigidbody so physics are properly simulated.
I’m still chatting about using raycasts for example for stuff like submachineguns so feel free to check it out if you’re interesting in finding out about how FPS’ do their shooting realistically.
If you wanted to be really fancy with the flamethrower effect I suppose what you could do is have your collider at a really small scale and then grow it through code alongside your flame as long as you have the mouse button held down.
Found some code for you that should do the trick.
So there is no easy answer. Hmm. Your suggestion with using a single collider might work in some cases (like enemy attack with pre-determined animation) but not for a player that can move while firing.
Your second idea (having a secondary “emitter” that instaniates dummies with Rigidbody properties set to match the particles’ trajectory) might be a better solution. I also thought about it but wanted to check if there is another way. Finally, it seems that particle positions themselves can be accessed through code Detecting Particle Collisions - Questions & Answers - Unity Discussions So in theory it is possible to calculate a bounding box around all living particles and check if the target is inside. I’ll need to do some experimenting myself. Thanks.
No problem and yes, depending on what you want to do it is just a case of experimenting and finding the right solution for your particular problem.