Only one mouse button can click at a time


When you are holding a mouse button, the other will not register. I really don’t know why. PG:

Lines 426 - 456 are the mouse button handlers

One hint: Provide PG that focus only on your problem. You will get slower responses if we have to go to line 400ish before finding the relevant code :slight_smile:

Hi Givo,
not sure what you are exactly looking for but this PG deals with simultaneously pressed mousebuttons. It uses the event’s buttons property and scene.onPointerObservable

1 Like

@Deltakosh Yep, I can see that happening. I’m gonna make a pg for most of the common sections of code I have. (One for pointer lock, input, update loop, movement, rays, etc).

@holger This works great! And I like pointer lock too! Thanks!

Credits go to @syntheticmagus he once helped to fix this issue for me :wink:



Hold up! I just implemented it, and there is a BIG issue.

Left click to fire. a small sphere will pop up where you hit. (plus some spread, of course.) I you hold down left click and look around, balls keep popping up. This means that the click event is somehow reset when you move the mouse. Have you had this?

Don’t know if it’s just me, but my aim is atrocious. :smiley:

The issue you were encountering came from the fact that that event gets fired every time the mouse does something, including move. Checking the presence or absence of the button flag just tells you whether that button is down, not whether it was just pressed. There’s probably a cleaner way to do this (at least, it seems like there should be), but in order to distinguish press from down, all that’s necessary is to look for the frame where the button flag switches from being absent to being present, which just requires remembering the state of the button from one frame to the next. The only lines I changed were 449 and 463 through 470. Hope this is helpful!


Oh, I didn’t think of that. Thanks!

BTW your aim is fine. I have weapon spread implemented. Just spam left click to see how much it varies.

1 Like