Improved recoil algorithm.

改进后座力算法。
This commit is contained in:
Cold-Mint 2024-09-04 23:23:22 +08:00
parent 1429b879e8
commit 41a2cebf41
Signed by: Cold-Mint
GPG Key ID: C5A9BF8A98E0CE99

View File

@ -93,8 +93,7 @@ public abstract partial class WeaponTemplate : PickAbleTemplate
//我们在每次开火之前,检查武器的后坐力。
if (_recoilStrength != 0)
{
var force = -characterTemplate.GlobalPosition.DirectionTo(enemyGlobalPosition) * _recoilStrength * Config.CellSize;
characterTemplate.AddForce(force);
characterTemplate.AddForce(enemyGlobalPosition.DirectionTo(characterTemplate.GlobalPosition) * _recoilStrength * Config.CellSize);
}
}