@Fallout: Let me see if I can offer some help...
Okay, you want to convert direction (y angle), azimuth (x angle) and speed (a "scalar" quantity which is the "magnitude of the velocity vector) into a velocity vector and back.
If I'm figuring correctly, the velocity vector with components <vx, vy, vz> should be calculated:
[edit] Let's try again...
rem x_angle is azimuth => straight up is -90, straight down is 90
rem y_angle is direction => north is 0, south is 180
vx = speed * cos(y_angle)
vy = speed * sin(x_angle)
vz = speed * cos(y_angle) * cos(x_angle)
To convert back:
speed = sqrt(vx*vx + vy*vy + vz*vz)
y_angle = acos(vx/speed)
x_angle = asin(vy/speed)
Give that a try!
Also, to compute position, you keep track of the time in "timer_last" which is the last time we moved the object, and then use the incremental variation of the "distance = rate * time" equation:
rem time is in seconds
rem speed and velocity are in world coordinates per second
timer_now = timer()
delta_t = (timer_now - timer_last) / 1000.0 : rem convert to seconds
px = px_prev + vx * delta_t
py = py_prev + vy * delta_t
pz = pz_prev + vz * delta_t
position object objnum, px, py, pz
px_prev = px
py_prev = py
pz_prev = pz
timer_last = timer_now
Hope this helps...
Ed