Hello Unity3D i have a question about hitsparks.How can i make it that when my character throws a ball or punches another character a spark comes out of the hit?for example i punch another character and after the punch has been landed i want like a rainbow spark to come out.Do i need a “OnCollisionEnter” code or" OnTriggerEnter"?If anyone knows how to do this.Can you please tell me how it can be done?
//if that contact point or quaternion doesnt give you realistic result you should tweak it //but for the start you can use this and see how it turns out
void OnCollisionEnter(Collision col) {
if(col.collider.tag=="enemy"){ //if spark is the name of your particle system
instantiate(spark, collision.contacts[0].point,Quaternion.identity);
}
}
Thanks Ill turn it to a Javascript and try it out