PatHightree / SpaceNavigator

SpaceNavigator driver for Unity3D
MIT License
170 stars 55 forks source link

Camera Zooms away when Space Mouse is plugged in, (with mouse in dead zone). #54

Closed chargedneuron closed 1 month ago

chargedneuron commented 1 year ago

Describe the bug As soon as the device is recognized by the system, the camera seems to Z Axis zoom away as well as translate across X & Y (mouse Axis). Locking Translate seems to hold the camera in place. If I lock Translate Z, the camera drifts quickly in X&Y. I have tried both my Space Mouse Pro Wireless (In wired mode), and Space Mouse Wireless (in wired mode).

Not sure where to start troubleshooting further from here.

To Reproduce Steps to reproduce the behavior:

  1. Install package from GIT.
  2. Select Scene view.
  3. Open SpaceMouse Window.
  4. Plug SpaceMouse into USB via Micro USB port on device.
  5. Scene View goes grey because the camera has moved and zoomed very far away from scene objects.

Expected behavior I would expect the Camera to behave similar to Blender or Solid Works, where the Camera would translate and rotate as per the input from the SpaceMouse.

Details (please complete the following information):

Additional context Add any other context about the problem here.

My project is already using the new Unity Input System without other issues. I have been using the Input System for a few projects now. I was able to use the v1.0 plug in years ago (Unity 5) before macOS disabled the ability. I have tried several times to use the new v2 plugin without any luck at all - yet. I use my SpaceMouse devices with Blender and SolidWorks frequently.

Your assistance is appreciated as is your dedication to this project. Thank you.

PatHightree commented 1 year ago

Try version 2.0.0-pre.8 and increase the deadzone sliders until the drift stops. Wireless devices could very well have different axes behaviour than the wired SpaceNavigator that I develop with. Hardware permutations are an unsolved problem at the moment.

chargedneuron commented 1 year ago

I dont know if it will help but I helped address the hardware permutations issue when Blender added support. I was able to provide limited information. see this link. Though this information may be outdated by now.

I installed version 2.0.0-pre 8 with the same results. I tried wired and wireless.

After looking at Unity's Input inspector I am wondering if Unity is seeing input from the devices at all. Unity does detect the device connecting and disconnecting and I can see the device info in Unity. I am seeing values present for the axis in the device inspector, non-zero values. This explains why the Camera zooms away. But the values are not changing when I move the SpaceMouse. Both devices work normally with both wired and wireless.

I have uploaded a YouTube video showing my testing of the devices against Unity. Link (Video is in HD, but may still be processing)

Thank you

indyjason79 commented 1 year ago

I'm having the same issue. Tried messing with the deadzone sliders and does not fix it.

chargedneuron commented 1 year ago

Additional info;

I recently had to format my drive and reinstall everything. Installing a fresh copy of macOS, Unity and Space Navigator v2p9 but not installing the 3dConnexion drivers. Here is what changed.

Unity does now see and respond to Space Mouse input, (both of my devices). Translation seems to work OK. its a bit touchy but works. Rotation seems to be mapped to the Mouse; Rotation X seems to be Mouse X, Rotation Y seems to be Mouse Y and Rotation Z seems to be Mouse Scroll wheel.

Unity's Editor Camera does still zoom off when first detecting the Space Mouse. And Unplugging a Space Mouse makes the Unity Interface go bonkers. And there is still Camera drift when the device is idle.

I have uploaded Screen Shot Videos to YouTube for review.

I suspect that there is some kind of conflict on the macOS with the 3DConnexion Driver and SpaceNavigator code. Eventually I will want to install the 3DConnexion Drivers to utilize the Buttons on the Space Mouse Pro.

Those Video Links are; https://youtu.be/Mt1nYJT3g2M https://youtu.be/M7w896vYMs0

PatHightree commented 1 year ago

As a workaround you could try the latest 3DConnexion driver, it supports Unity these days. The SpaceMouse Pro isn't on the depricated list, so it should be supported.

chargedneuron commented 1 year ago

After installing the 3DConnexion macOS Driver I have the following;

The Camera is drifting slightly. No input from the mouse is detected in Unity. Input Debug window for SpaceNavigatorHID shows values, (non-zero), but they no longer change with Space Mouse input. Other than drifting, there is no Camera movement from the Space Mouse.

3DConnexion Demos and Blender work as expected.

Screen Shot 2022-09-12 at 8 23 08 AM plend

jg33 commented 1 year ago

I'm experiencing the same behavior. Wireless Spacemouse on a Mac. Have there been any updates? Thanks!

PatHightree commented 1 month ago

Hi there, sorry for the delay (understatement) but life got in the way and this project plummeted way down the prio list. I recently picked up my spacenavigator and it suffered from the drift issue you describe. I implemented a fix for the drift issue by subtracting the first measured translation/rotation from the current reading. It seems to work well.

The fix is available in version 2.0.0.pre-10.