Hello,
I’m trying to add a slight weapon spray to my game. The way im doing it is by slightly adjusting the Y rotation to give me a horizontal type spray but I’m having some really bad issues with it.
At the moment it is shooting off to an angle and if I rotate the player around 360 the offset gets increased and the weapon no longer fires forward but off to the side, this increase the more I rotate the player in the same direction.
Any help would be great! thanks.
Code:
private void CalculateSprayWeight()
{
Quaternion direction = firePoint.localRotation;
direction.y += Random.Range(-sprayWeight, sprayWeight);
firePoint.Rotate(direction.x, direction.y, direction.z);
}