I wish to know how to have a crosshair change size based off of the Fire cone for a weapon
Lets say the crosshair is a circle
I wish to know how to have a crosshair change size based off of the Fire cone for a weapon
Lets say the crosshair is a circle
You mean cross hair radius based on bullet spread?
Ie if the weapon is accurate the cross hair will be small, and if the weapon is less accurate, the cross hair will be bigger.
There is not a lot of math involved. Suppose you express bullet spread in angles. ie an accurate weapon will have an angle closer to 0 and a less accurate weapon will have something like 10 degrees.
In this situation you must first decide a base line. Lets call this L. No we will need to calculate an R whcih will be the radius of the cross hair:
So in the image above, a is the angle (bullet spread), L is the baseline which controls the proportion and R
is the radius of cross-hair(which we need to find out). So this ends up as a pure trigonometry problem. You have the angle(and hence the tan) and the length adjustment side and you need the length of opposite side. Which trigonometric relation puts all this into play? Tan!! (opposite side by adjuscent side). So
R = tan(a) * L
Simple!
Now you can adjust L to control the proportion of cross-hair radius. Lower values of L will result in smaller cross hairs and larger values of L make the cross hair grow bigger much faster with spread.