Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpaceNavigatorHID.current.Rotation.ReadValue() returns 0 0 0 in build version #44

Open
Georodin opened this issue Nov 24, 2021 · 5 comments

Comments

@Georodin
Copy link

Describe the bug
SpaceNavigatorHID.current.Rotation.ReadValue(); returns in Standalone build only Vector3(0, 0, 0);
When use in GameMode it works fine. Also SpaceNavigatorHID.current.Translation.ReadValue(); still returns all values in all modes
just rotation returns zero values
using the 3Dconnexion wireless version in Unity 2020.3.5f1 using SpaceNavigator-2.0.0-beta.7

To Reproduce
Steps to reproduce the behavior:

  1. create new HDRP project in Unity 2020.3.5f1
  2. copy the SpaceNavigator-2.0.0-beta.7 folder to the packages folder
  3. accept the prompt to change to the New Input System
  4. after restart add a script to the camera to vizualize the movement of SpaceNavigatorHID.current.Rotation.ReadValue();
  5. Debug.Log both SpaceNavigatorHID.current.Rotation.ReadValue(); and SpaceNavigatorHID.current.Translation.ReadValue();
  6. try it in GameMode, it does work normal
  7. build the project
  8. in the builded project only SpaceNavigatorHID.current.Translation.ReadValue(); returns values while SpaceNavigatorHID.current.Rotation.ReadValue(); only returns Vector3(0, 0, 0); constantly

Expected behavior
SpaceNavigatorHID.current.Rotation.ReadValue(); should return values other than zero in builded versions

Details (please complete the following information):

  • Issue occurred while [in the editor viewports, in play mode]
  • Device type: Spacemouse 3dconnexion
  • Connection: wireless
  • OS: Windows
  • SpaceNavigator-2.0.0-beta.7

Additional context
Add any other context about the problem here.

@Georodin
Copy link
Author

Georodin commented Dec 1, 2021

        void Start()
        {
            Type wireless = typeof(SpaceNavigatorWirelessHID);
            System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(wireless.TypeHandle);

            Type wired = typeof(SpaceNavigatorHID);
            System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(wired.TypeHandle);
            Debug.Log("Called static");
        }

I added this manual static constructor call to my Camera script and at least the SMW works now in build mode
but when I connect it via wire it again ignores the rotation axis but this time everywhere not only in the build

@JackeyC
Copy link

JackeyC commented Dec 29, 2021

I am having the same issue too

@nilmother
Copy link

Hi Georodin,

I am pretty new to programming and tried to implement your solution for making the Wireless Spacemouse work in BuildMode. However I am struggling with the script, the "Type" wireless is screaming at me..
Could you provide more information about how to implement your solution?
I and my architecture studies would be deeply grateful.
Thanks

@Georodin
Copy link
Author

Hihi nilmother,
so that your script can use the Type thingy you need

using System;
using System.Reflection;

these both at the top of you script
those are called namespaces and tell the compiler where to look for Type because sometimes you can have ambiguity within names

and the only thing im doing is finding the constructor of the SpaceNavigatorWirelessHID and call it manually because it's not
called automatically
but the then constructed Object is needed to get Inputs from the SpaceNavigator

if it's something else, then let me know

@nilmother
Copy link

Dear Georodin,
it works, thank you so much!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants