I have been trying to write an expression for controlling a craft via advanced pod controller, and I wanted to use vector thrusters for lateral movement control.
For me to accomplish this, I know I need to get the forward vector, the right vector, and the up vector, all in relation to the craft itself.
I tried to accomplish this using the following method:
Create 4 GPSs (Front, Right, Back and Left)
Use each of the vector outputs from them as inputs
Determining the forward vector by subtracting Front from Back
Determining the right vector by subtracting Right from Left
Determining the up vector by cross-multiplying the forward and right vectors
So:
Code:
I@ F R B L W A S D
O@ Direction Mult
interval(40)
FB = vecnormalize(vecsub(F, B))
RL = vecnormalize(vecsub(R, L))
UP = vecnormalize(veccross(FB, RL))
W->Direction = -FB;
S->Direction = FB;
A->Direction = RL;
D->Direction = -RL;
Mult = 10
So if I press any of the directional keys I move in those directions, but regardless of the direction I am facing, the thrust still goes in the same directions, rather than the directions relative to the craft. I have local xyz on but these always seem to fire in world directions...
Eventually I want to have it stop movement when no keys are pressed.
How can I resolve the issue of the world directions vs local?
Am I doing something incorrect to cause this?
How would I implement the stop functionality, preferably using delta?
Thanks very much for your suggestions.
Bookmarks