This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

Primary click sometimes not registering in project

stoutstout Posts: 3Member

Hi all,

I'm having an issue where the left click action is sometimes not registering unless I press the button with more force than normal.

I'm using MacOS 10.15.4 and Godot 3.2.1 stable with a Logitech MX Master 3 wireless mouse, although I've had the same problem with other wireless mice and the trackpad itself.

I do not have this issue in the editor nor any other program I have on my computer that I've found.
The issue also persists in the exported project as well.

The code I'm using is just the bog standard:
if Input.is_action_just_pressed("mouse_1"): # do whatever

No other inputs, such as keyboard keys nor other mouse inputs have any issues.

I guess my question is if this is a known issue or if anyone else has encountered this issue.

My guesses so far is that it's either something I messed up, some problem with OpenGL with MacOS, or something happening with Mac's "force touch" feature applying to mouse inputs as well.

Any work arounds or advice would be really appreciated.


Tags :

Best Answer

  • cyberealitycybereality Posts: 928
    edited April 2020 Accepted Answer

    I've had the best results from doing actions (like attacking, jumping, etc.) from _input().

    func _input(event):
        if event.is_action_pressed("take_action"):
            # do something here
    

    This works great for action type events. For continuous movements (for example, mouse look in an FPS game, or D-Pad movement in a platformer) I found _process() or _physics_process() to give better results.

Answers

  • MegalomaniakMegalomaniak Posts: 2,580Admin
    edited April 2020

    Is the line inside _process()?

    If so it's probably more about how long you have to hold the button for the press to register. Basically _process() gets called on every frame rendered and if theres a lot of frames rendering you might be missing the frame interval for the press to register.

    Either try using Input.is_action_pressed("mouse_1"): instead of Input.is_action_just_pressed("mouse_1"): or try moving the functionality into _physics_process() instead.

    Been a very long time since I've used a mac however so I can't rule out some funkiness on it's part, I suppose.
  • cyberealitycybereality Posts: 928Moderator
    edited April 2020 Accepted Answer

    I've had the best results from doing actions (like attacking, jumping, etc.) from _input().

    func _input(event):
        if event.is_action_pressed("take_action"):
            # do something here
    

    This works great for action type events. For continuous movements (for example, mouse look in an FPS game, or D-Pad movement in a platformer) I found _process() or _physics_process() to give better results.

  • stoutstout Posts: 3Member
    edited April 2020

    Thanks so much for the replies.

    So after some more research unrelated to Godot, I found that Magnet, a program for better window snapping/splitting in MacOS was the cause of the issue somehow. Quitting the program solves my issue, so there was some definite funkiness going on.

    Although using the func _input(event) function solved the problem while having the aforementioned program running in the background.

    Do the two methods having different input polling techniques?

    Anyway, thank you both for the help. I learned some new things!

  • cyberealitycybereality Posts: 928Moderator

    Cool. Good to hear you figured it out.

Sign In or Register to comment.