Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Help Wanted Custom device for SpaceNavigator

Discussion in 'Input System' started by PatHightree, Aug 20, 2020.

  1. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    275
    Hi there,
    I'm trying to get my SpaceNavigator to play nice with the Input System, but I can't figure out how to tell it to use 16 bit floats.
    This is the HID descriptor and my wip output
    upload_2020-8-20_22-38-59.png

    Using this code
    Code (CSharp):
    1.    
    2. [InputControl(name = "translation", offset = 8, format = "VC3S", layout = "Vector3", displayName = "Translation")]
    3.     [InputControl(name = "translation/x", defaultState = 0.0f, format = "SHRT", parameters = "normalize,normalizeMin=-32768,normalizeMax=32768,normalizeZero=0.0")]
    4.     [InputControl(name = "translation/y", defaultState = 0.0f, format = "SHRT", parameters = "normalize,normalizeMin=-32768,normalizeMax=32768,normalizeZero=0.0")]
    5.     [InputControl(name = "translation/z", defaultState = 0.0f, format = "SHRT", parameters = "normalize,normalizeMin=-32768,normalizeMax=32768,normalizeZero=0.0")]
    6.  
     

    Attached Files:

  2. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    275
    Another attempt.
    Without the custom device, the rotation data is received correctly by the input system.
    The rotation values (rx,ry,rz) change when I move the device.
    But the translation (x,y,z) data is mangled up in the stick input and not changing at all, the z value is identical to rz.
    upload_2020-8-22_11-59-55.png

    So my next attempt was to recreate the the part which does work (the receiving of the rotation data) in a custom device.
    I duplicated it as best I could, but I'm not receiving any data.
    Code (CSharp):
    1.  
    2. [InputControl(name = "rx", offset = 1, format = "SHRT", layout = "Axis", displayName = "RX")]
    3. public int rx;
    4. [InputControl(name = "ry", offset = 3, format = "SHRT", layout = "Axis", displayName = "RY")]
    5. public int ry;
    6. [InputControl(name = "rz", offset = 5, format = "SHRT", layout = "Axis", displayName = "RZ")]
    7. public int rz;
    upload_2020-8-22_12-4-26.png
    What's suspicious is that the events log shows my FourCC format "MINE" when I don't touch the device, but HID when I move it. Suggesting that my device registration is not working correctly.
    (source is attached to post)

    Code (CSharp):
    1.         InputSystem.RegisterLayout<CustomDevice>(
    2.             matches: new InputDeviceMatcher()
    3.                 .WithInterface("HID")
    4.                 .WithCapability("vendorId", 0x46D) // 3DConnexion
    5.                 .WithCapability("productId", 0xC626)); // SpaceNavigator
     

    Attached Files:

    Last edited: Aug 22, 2020
  3. Tongpan2020

    Tongpan2020

    Joined:
    Nov 4, 2020
    Posts:
    2


    Joined:
    Today
    Posts:
    1
    New
    Hi PatHightree

    Your space navigator driver runs well in game tab, but it crush in built application. The error is
    "NotSupportedException: Specified method is not supported.
    at (wrapper cominterop) TDx.TDxInput.DeviceClass..ctor()"

    I saw some threads mentioned this problem. But I can't find a solution. I tested the version 1.5.3. It doesn't fix the problem.

    Can you tell me how to fix this issue?

    Thanks
     
unityunity