I am trying to make a particle based machine gun!
so far everything I have needed has come from the scripting reference, but I have been having trouble figuring out how I can tell a script where a particle collision was in a variable. This is so hit sparks can be made at a collision point.
I think what might work is telling the script that when a particle has collided, to instantiate the sparks at it's location, rather than at the collision point, which apparently the OnParticleCollision function doesn't do.
AJ - indie game maker and dreamer... lol :)
asked Jun 01 '10 at 06:39 AM
If I would be in you I'd just use a raycast to see where the gun is aiming and just relocate a particle emitter of sparks in that location (at the crossing of the ray with the first mesh). No need to spawn it: just spawn it when the player hits FIRE, then relocate it to raycast landing point until FIRE is pressed.
Hope this is a good solution for you :)
We are actively working on collision messaging ATM and with any luck it should go into Unity 4.2. This will let you read collision impact points, incident velocity etc. With this data you can easily cause damage and/or apply forces to collidees.