// ----------------------------- AddNoiseToKick -------------------------------- // // this can be used to vary the accuracy of a player's kick. Just call it // prior to kicking the ball using the ball's position and the ball target as // parameters. // ----------------------------------------------------------------------------- Vector2D AddNoiseToKick(Vector2D BallPos, Vector2D BallTarget) { double displacement = (Math.PI - Math.PI * Prm.PlayerKickingAccuracy) * Utilities.RandomClamped(); Vector2D toTarget = BallTarget.subtractToCopy(BallPos); toTarget.RotateAroundOrigin(displacement); return toTarget.add(BallPos); }