Jump to content

KeyHit question p c++]


cassius
 Share

Recommended Posts

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.

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

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

Link to comment
Share on other sites

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.

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...