Hi, I am trying to make gun spray pattern recoil like CS:GO.
I was thinking maybe I can cycle through a Vector3 Array. But I Don't know how to lerp from one Vector3 to another to another
I was thinking doing something like
public class Recoil : MonoBehaviour {
public Vector3[] sprayPattern;
public float speed = 5f;
public void Recoiling()
{
Vector3.Lerp (sprayPattern [0], sprayPattern [1], speed);
Vector3.Lerp (sprayPattern [1], sprayPattern [2], speed);
Vector3.Lerp (sprayPattern [2], sprayPattern [3], speed);
}
}
And I would call the Recoiling() Function in my weapon Script.
But Then I was thinking, what if I have more than 4 Vector3s in my array.
Essentially, I need help getting a spray pattern like CS:GO
Oh and, animations won't work for this.
↧