cassius Posted November 22, 2015 Share Posted November 22, 2015 I use KeyHit "G" to pick up objects. I hide the picked up object and set a bool flag to say its picked up. Tonight I accidently clicked on "G" twice and when I got near a second object it was "picked up" already without another click on "G" Tried FlushKey but made no difference.All required bool flags were set but it seems to defy logic. Any help would be appreciated. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Rick Posted November 22, 2015 Share Posted November 22, 2015 My guess is your KeyHit() check is done inside some other if statement. Generally if you have it as a top level check where it's always checked each frame you won't run into this issue. I would have thought flushing would have worked too though. On another node I've for the most part stopped using the Hit() methods and make my own with a boolean flag to avoid the issues it has. if window:KeyDown(Key.A) and aKey == false then aKey = true --- do key hit stuff elseif window:KeyDown(Key.A) == false and aKey then aKey = false end Quote Link to comment Share on other sites More sharing options...
cassius Posted November 22, 2015 Author Share Posted November 22, 2015 if (jane.model->GetDistance(key01) < 2.0 && gotkey == false) { if (window->KeyHit(Key::G)) { gotkey = true; key01->Hide(); } heres the code I use I will try your suggestions. Thanks. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Rick Posted November 22, 2015 Share Posted November 22, 2015 yeah, I would just swap those if statements. check for the KeyHit() first so it gets called each frame. that should prevent the queuing that you are seeing. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.