I am going to make an automatic canon in the sandbox game gmod, but I have never taken a physics class. The projectile will have a constant initial velocity, and will usually be fired on a map with level ground (though I may modify it later for uneven ground as well). The only thing I can controle is the direction and the angle at which it is fired. Thanks for the help .

is the sin2(variable) in the denominator?

The formula for the distance a projectile will travel fired with initial velocity v and angle ? above horizontal is

d = v²/g * sin2?

the maximum distance is obtained at ? = 45º

g = 9.8 m/s²; v in m/s and d in m.