@Kojack Do you have any experience with the Space Mouse on macOS? I am wondering if I am missing something or it's really this messed up. See 3 posts above. Thanks.
3Dconnexion Space Mouse Support in Godot
- Edited
cybereality
Never even tried plugging a space mouse into a mac.
Maybe try calling
hid_darwin_set_open_exclusive(0);
before opening the device. Apparently that was added to hidapi in march, after 3 years of people discussing problems with shared access to hid devices on macs.
But that's just me with google, I avoid mac development.
Thanks, @Kojack . That seemed promising, but was already in the code. I also tried setting it to 1, but it was the same. Will have to keep looking.
I looked all on Github and I see what the issue is. The official driver on macOS (starting with Big Sur) opens the Space Mouse in exclusive mode, so there is nothing I can do to get access via HIDAPI after that point. This is unfortunate, but at least I know it's not a bug in my code. Maybe I will see if I can disable the mouse emulation so it will at least work if you uninstall the driver.
- Edited
cybereality
Is there any kind of per app configuration on the mac connexion software?
On windows, the app has that pic I posted above. The default for all non connexion aware software is the pitch axis is enabled and does mouse wheel emulation, everything else is disabled. You can turn it off manually if you get double input (HID and mousewheel).
The app configurations are stored in xml files, so maybe you can make a godot config file that just turns everything off for godot. I have no idea where a mac would store those though (if they even exist on a mac). For windows, the files are at C:\Users\kojack\AppData\Roaming\3Dconnexion\3DxWare\Cfg\
Edit: wait, no, you are talking about when the drivers aren't installed. Ignore all that.
I guess macs are treating it as a generic HID device themselves and add default support.
So, yes, I considered that. The Mac app is more limited, it's not like Windows where you can enable/disable axis and stuff. Even if you could, that doesn't help, cause the service starts at boot and attaches with exclusive access. So AFAIK there is no way to get it to work with the driver installed. I saw a few people with the same exact issue and there is no work around.
That said, I was able to get it working without the driver. I just had to connect to it with exclusive access, and then that disables the mouse cursor emulation. I would have liked to get the driver working too, but for that I would need the official SDK and I don't feel like doing that at this point. One cause there are license concerns, and two I don't really feel like supporting their software with the way they treat non-Windows users. Also having to support two code paths in the library. Not worth my time.
So it's all working and tested on Windows, Linux, and macOS, with both the new wireless model Space Mouse and the older Space Navigator. Those are the only formats, so, in theory, most of the other devices should work as well, but I'll have to get feedback as I don't have the hardware. I'm working on a video now, and the Github page, should be up in a few hours.
- Edited
Well, it kinda works. Most things being inverse and wayyyyy too sensitive.
Strange. I tested the old wired (same one I sent you) and the new wireless model, on Windows, Linux, and macOS. This was designed for Godot 3.4.4 but it should be compatible, I don't think the API changed. Can you list out the relevant specs of your machine (OS and version, Godot version, etc.)?
Also, check Github again. I updated the Readme with some OS specific instructions.
Megalomaniak Well, it kinda works. Most things being inverse and wayyyyy too sensitive.
I also tested on 60Hz and 144Hz monitors, but since the update happens in Godot (in _process()) there may be some timing issues if you have a weird refresh rate. What kind of monitor do you have?
@Megalomaniak If you're on Windows, you have to open the 3Dconnexion driver after you open the Godot editor. Then click the settings, it should show a popup for the godot-x86_64.exe. In there, uncheck everything, so that you don't get double control.
- Edited
cybereality Strange. I tested the old wired (same one I sent you) and the new wireless model, on Windows, Linux, and macOS. This was designed for Godot 3.4.4 but it should be compatible, I don't think the API changed. Can you list out the relevant specs of your machine (OS and version, Godot version, etc.)?
I'm pretty sure it's just up to expectations and preferences. I tend to think in terms of moving and manipulating the camera rather than the object/world which causes everything to feel inverse to my brain. In other words: it's psychosomatic.
edit: well, the sensitivity might be to do with my device being new and underused. Hasn't "worn in" yet perhaps so still overly sensitive.
- Edited
cybereality I also tested on 60Hz and 144Hz monitors, but since the update happens in Godot (in _process()) there may be some timing issues if you have a weird refresh rate. What kind of monitor do you have?
75hz Freesync over HDMI and radeon chill is set to 'on', targeting 50 to 75 range in global profile. But godot reports pretty much a constant 75fps update anyways.
- Edited
Megalomaniak I'm pretty sure it's just up to expectations and preferences.
I could see that. I've been using the Space Mouse off and on for like 15 years, so I am very comfortable with it. When I first got it it did seem very fast, but it's just sensitive. Also note that the focus/pivot is on the selected object (or the world origin, if nothing is selected). The movement will slow down as you get closer to the object.
I tried to tweak it to get a balance where you could still control and get up close to something down to like 10cm but it would still feel okay up to like 10m. If you go too far out it will get fast, so if you have a large level you might have to click on an object closer to the camera.
I wanted to add sliders to adjust the speed, but it doesn't look like you can export variables in editor plugins. My only option was to make a new dock, where I could attach settings. I might still want to do that, depending on the feedback I get. In the meantime, you can open the file addons/spacemouse/SpaceMouse.gd and look for these two variables.
const translate_speed = 0.1
const rotate_speed = 0.02
Feel free to change them if you like (you will have to enable/disable the plugin to see the effect). Converting the code to fly the camera is probably a lot more work, but I can look into it. I might have to make that dock anyway, so if that's the case I can put in some other options.
- Edited
cybereality In the meantime, you can open the file addons/spacemouse/SpaceMouse.gd and look for these two variables.
const translate_speed = 0.1
const rotate_speed = 0.02
Feel free to change them if you like (you will have to enable/disable the plugin to see the effect).
I suspect trying to tighten those scalar values down would likely just run into floating point precision issues, but I guess I could try.
cybereality I wanted to add sliders to adjust the speed, but it doesn't look like you can export variables in editor plugins. My only option was to make a new dock, where I could attach settings.
I think in this case, just having a config.ini or just conf(no extension) file in a sort of plain text format would probably be fine.
@Megalomaniak @Kojack
I just pushed version 1.4.1, which adds an editor dock to adjust speed and added a new fly camera mode.
https://github.com/cybereality/godot-space-mouse
- Edited
It might be a good idea to include the version number in the release zip file name.
Edit: yeah this is a huge QoL improvement! the camera mode with some speed adjustments makes a big difference.
Haven't tried it yet, but I will.
Megalomaniak It might be a good idea to include the version number in the release zip file name.
Yeah, good call. I updated the zip names.