Re: moving players in angles like in FPS type games
x = r × cos θ
y = r × sin θ
If you're doing 3d:
x = r × cos θ × cos φ
y = r × sin θ × cos φ
z = r × sin φ
Assuming that z is vertical. If not, just swap z and y.
θ = rotation in the x/y plane.
φ = elevation above or below the x/y plane.
Both θ and φ are in radians. 1° = π/180.
r is the total distance.
There is a way to use rotation around each axis, but I would have to work out how it works and/or look it up.
Learning the Unit Circle might be helpful, but you probably won't need anything that it'd be helpful for. Mostly, it might be helpful to remember that cos (0) = 1, cos (π/2) = 0, sin (0) = 0, and sin (π/2) = 1.
If you want to get more technical, you could ditch angles and use orientation vectors. That's basically those three equations at the top, where r = 1, put into a vector, meaning it points in the direction corresponding to the angles. Ex, facing right would be (1, 0, 0), left would be (-1 0, 0), and further examples depend on how you handle y and z.
Next time, I'm just writing "theta" and "phi" and "pi". UEB is annoying.
-- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector