Hello,
I am new to this forum and until now I have been working on a hobby project - a solar system/night sky simulator - since late March now and have found a lot of help from existing topics and discussions here. This is an awesome and active community. I love it!
Today I think I may found a bug, since I couldn’t find any evidence of whether this behavior is intended.
In my simulation I use/would like to use a couple of key combinations for debugging purposes. One of them is to progress the simulation time in a convenient way, using different key modifiers to distinguish between days, month and years as well as going backwards or forwards in time. In addition to that I use the keypad keys for the actual numeric values (e.g. Control+Shift+Keypad 3 should advance the simulation time by 3 years)
Currently my code looks like this:
double progressSecondsInSimulation = 0.0;
double progressTimeMultiplier = 1.0;
float progressTimeSign = 1f;
int progressTimeValue = 0;
/* forum note: the following if statements regarding progressTimeMultiplier were in a combined if-else-block and in reverse order previously, however this isn't the cause of my problem.
The convenient way I was talking about intends the setting of three numeric values that are multiplied at the end to avoid redundant and nested if-blocks */
// progress hours
progressTimeMultiplier = SECONDS_PER_HOUR;
// progress days
if((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)))
progressTimeMultiplier = SECONDS_PER_DAY;
// progress months
if((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)))
progressTimeMultiplier = SECONDS_PER_DAY * DAYS_PER_MONTH;
// progress years
if((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) && ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))))
progressTimeMultiplier = SECONDS_PER_DAY * DAYS_PER_YEAR;
// progress reversely
if(Input.GetKey(KeyCode.LeftAlt))
progressTimeSign = -1f;
if(Input.GetKeyDown(KeyCode.Keypad1))
progressTimeValue = 1;
else if(Input.GetKeyDown(KeyCode.Keypad2))
progressTimeValue = 2;
else if(Input.GetKeyDown(KeyCode.Keypad3))
progressTimeValue = 3;
else if(Input.GetKeyDown(KeyCode.Keypad4))
progressTimeValue = 4;
else if(Input.GetKeyDown(KeyCode.Keypad5))
progressTimeValue = 5;
else if(Input.GetKeyDown(KeyCode.Keypad6))
progressTimeValue = 6;
else if(Input.GetKeyDown(KeyCode.Keypad7))
progressTimeValue = 7;
progressSecondsInSimulation = progressTimeValue * progressTimeSign * progressTimeMultiplier;
if(progressTimeValue > 0)
Engine.ProgressTime(progressSecondsInSimulation, false);
The combinations with Control (progress days) and Alt (progress reversely) as well as hours (keypad keys only) work fine. My problem is anything regarding the Shift modifier keys. They don’t work with keypad keys and seem only to work with the alpha numeric keyboard.
What I have tested so far:
Shift+G: works
Shift+Alpha0-9: works (I use them for other input however)
Shift+Keypad0-9: doesn’t work
If you think about the actual keyboard layout it makes sense since they do produce different character output. But this refers to word processing mainly. Also Control+Keypad or Alt+Keypad would not make sense in this way of thinking, but they DO WORK.
My understanding is that you can poll for each imaginable key combination that is possible using the GetKey# methods. Am I wrong or did I find a bug here?
Thank you in advance.