I am making a game in unity where you launch a ball into enemies and on collision they get damaged. I want to add a particle effect at the point where the 2 objects collide but I cant figure out how to get the location. Here is the collision script for the enemy:
private void OnCollisionEnter2D(Collision2D collision)
{
if(collision.relativeVelocity.magnitude > 7)
{
damage = damageConstant * collision.relativeVelocity.magnitude;
health -= damage;
CreatePopup(gameObject.transform.position, damage);
}
if(health <= 0)
{
Destroy(gameObject);
}
}
If you can also explain the solution that would be great for the future