Hi all,
I'm creating a PC game in which I have to shoot out a bullet from the pipe of a gun.
As I am not to good with trigonometry I had to improvise a little... then I came up with this formula:
position in x-axis: 14 * Sin(RotationAngle)- 37 * Cos(RotationAngle)
position in y-axis: 37 * Sin(RotationAngle)- 14 * Cos(RotationAngle)
and in a more mathematical form:
x-axis: c * Sin(a) - z * Cos(a)
y-axis: z * Sin(a) - c * Cos(a)
NOTE: z and c are variables
so here comes the question: Is there an easier way to write this function? (easier would equal faster in programming languages, it is faster to calculate one trig function than two)
The best way would either be one sin or one cos function: ex. Sin(v) and the next best would be s * Sin(v)
Thanks in advance
I'm creating a PC game in which I have to shoot out a bullet from the pipe of a gun.
As I am not to good with trigonometry I had to improvise a little... then I came up with this formula:
position in x-axis: 14 * Sin(RotationAngle)- 37 * Cos(RotationAngle)
position in y-axis: 37 * Sin(RotationAngle)- 14 * Cos(RotationAngle)
and in a more mathematical form:
x-axis: c * Sin(a) - z * Cos(a)
y-axis: z * Sin(a) - c * Cos(a)
NOTE: z and c are variables
so here comes the question: Is there an easier way to write this function? (easier would equal faster in programming languages, it is faster to calculate one trig function than two)
The best way would either be one sin or one cos function: ex. Sin(v) and the next best would be s * Sin(v)
Thanks in advance