- Joined
- Nov 20, 2007
- Messages
- 11,962
- Reaction score
- 765
- Points
- 188
Put two new cases for the 'C' and 'V' keys. 'C' for engines cut-off and 'V' for vectoring. The 'C' works fine, and cuts-off the mains, the 'V' is working, but not giving results I expected...there's a surprise.
This is the state just after lift off:-
http://i89.photobucket.com/albums/k207/Notebook_04/09062309-51-03PB-01.jpg
I then put the negative value (-15000)into the 'z' element of thDir with the 'V' key, and this shows up in this second run:-
http://i89.photobucket.com/albums/k207/Notebook_04/09062309-51-45PB-01.jpg
However, the direction of thrust is still in the +Z direction, I was expecting it to reverse to the -Z, after the 'V' key-press?
All input appreciated!
N.
Code:
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] BlueStreak::clbkConsumeBufferedKey (DWORD key, [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]bool[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] down,[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]char[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] *kstate)
{
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (!down) [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] 0; [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//only process keydown events
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (!KEYMOD_SHIFT (kstate))
{ [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// unmodified keys
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]switch[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (key)
{ [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]case[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] OAPI_KEY_L: [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// Fire mains
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]SetThrusterLevel(th_Pack[0], 1);
SetThrusterLevel(th_Pack[1], 1);
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] 1;
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]case[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] OAPI_KEY_C: [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// Cut-off Mains
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]SetThrusterLevel(th_Pack[0], 0);
SetThrusterLevel(th_Pack[1], 0);
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] 1;
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]case[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] OAPI_KEY_V: [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// Vector Mains
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
SetThrusterDir(th_main, _V(0,0,-15000));
[/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//thDir = (_V(127,126,125));
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] 1;
}
}
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] 0;
}
[/SIZE]
This is the state just after lift off:-
http://i89.photobucket.com/albums/k207/Notebook_04/09062309-51-03PB-01.jpg
I then put the negative value (-15000)into the 'z' element of thDir with the 'V' key, and this shows up in this second run:-
http://i89.photobucket.com/albums/k207/Notebook_04/09062309-51-45PB-01.jpg
However, the direction of thrust is still in the +Z direction, I was expecting it to reverse to the -Z, after the 'V' key-press?
All input appreciated!
N.