Forum begins after the advertisement:
-
::Reposting a useful comment from <a href=”https://www.youtube.com/@Cryst2000” target=”_blank”>@cryst2000</a> on YouTube.
<blockquote>I think there is a bug in your code here that makes the enemy recoil towards you as well as the enemy is getting hit more than once. This is the fix.
<code>// Store player recoil direction (away from enemy)
recoilDirection = (transform.position - objectsToHit[i].transform.position).normalized;
// Send enemy recoil direction (away from player)
e.EnemyHit(damage, (objectsToHit[i].transform.position - transform.position).normalized, _recoilStrength);
hitEnemies.Add(e); // Mark this enemy as "already hit this swing"</code>
</blockquote>