Correct position for hit effect with directional targeting

At line 84 in Projectile.cs, the fireball’s hit effect is instantiated at the Aim location, which in this case causes the explosion to appear wherever the mouse pointer was at the time you clicked to launch the fireball. This can look very strange if the fireball overshoots and hits an enemy down range as the explosion effect will be in the wrong place.

I changed GetAimLocation() to transform.position and it gives a much more convincing effect:

    if (hitEffect != null)
    {
        Instantiate(hitEffect, transform.position, transform.rotation);
    }
3 Likes

Thank you. Now my explosions appear on the right place.

1 Like

Privacy & Terms