01-06-2005, 03:46 PM
Let's say I have an angle, and want to translate that into what I should add to a particles x and y
The way I used to do is:
Which works fine..
BUT
I'm making a particle engine, and i want to be able to specify by angle, instead of xf, yf:
Like:
0º, would become: xf = 0, yf = -2
45º, would become: xf = 1, yf = -1
90º, would become: xf = 2, yf = 0
270º, would become: xf = -2, yf = 0
etc, you get it (angles, and resulting xf, yf are just examples, doesent matter where 0º is)
Anyone know how to translate angle->(xf, yf).. and (xf, yf)->angle..?
The way I used to do is:
Code:
ptcl.x = ptcl.x + xf
ptcl.y = ptcl.y + yf
BUT
I'm making a particle engine, and i want to be able to specify by angle, instead of xf, yf:
Code:
angle = 167
ptcl.x = ptcl.x + Formula(angle)
ptcl.y = ptcl.y + Formula(angle)
Like:
0º, would become: xf = 0, yf = -2
45º, would become: xf = 1, yf = -1
90º, would become: xf = 2, yf = 0
270º, would become: xf = -2, yf = 0
etc, you get it (angles, and resulting xf, yf are just examples, doesent matter where 0º is)
Anyone know how to translate angle->(xf, yf).. and (xf, yf)->angle..?