TDx.TDxInput.dll for .NET 4.0

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

CarlEmail
Posts: 7
Joined: Sat Mar 23, 2019 5:27 am

TDx.TDxInput.dll for .NET 4.0

Post by CarlEmail » Sat Mar 23, 2019 5:37 am

I have been using the SpaceNavigator in Unity (the game engine) successfully for some time, but now that Unity is deprecating .NET 3.5 it is no longer possible to build working applications using SpaceNavigator. That is a shame.

I am using the "SpaceNavigator Driver" extension available on the Unity Asset Store. However, the problem lies not in the extension, but in the TDx.TDxInput.dll which is compiled for .NET 3.5. I have just downloaded the latest 3DWare drivers and TDx.TDxInput.dll remains .NET 3.5.

Is there any chance that 3DConnextion can provide a TDx.TDxInput.dll compiled for .Net 4.0?

All the best
Carl Emil

ngomes
Moderator
Moderator
Posts: 2150
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: TDx.TDxInput.dll for .NET 4.0

Post by ngomes » Mon Mar 25, 2019 8:48 am

Hi CarlEmail,

3DxInput is a deprecated interface. The driver still ships with a build to ensure older software can still operate in end-users machines but it's not intended for new development.

Recent version of the 3DxWare SDK have a .NET sample, TestSiapp. Our recommendation is to port the software to the driver's official API.
Nuno Gomes

CarlEmail
Posts: 7
Joined: Sat Mar 23, 2019 5:27 am

Re: TDx.TDxInput.dll for .NET 4.0

Post by CarlEmail » Thu Oct 24, 2019 8:59 am

I have returned to the problem of implementing SpaceNavigator input in .NET 4.0 Unity builds.

I am looking at the TestSiapp example. So far I've imported siappdll and Siapp.cs into Unity. I am now trying to recreate the functionality of Form1.cs and here I get stuck. The Form1 class inherits from Form which is not accessible. Somehow Message msg is send to the WndProc method after InitializeSiApp() is called in the Form1 constructor. How exactly do I subscribe to messages? I hope I don't need to point to a form window, because I am not sure such a concept exist in Unity.

All the best
Carl Emil

ngomes
Moderator
Moderator
Posts: 2150
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: TDx.TDxInput.dll for .NET 4.0

Post by ngomes » Mon Oct 28, 2019 1:03 am

Hi Carl,
How exactly do I subscribe to messages? I hope I don't need to point to a form window, because I am not sure such a concept exist in Unity.
Ultimately, the driver relies on a window to send messages to. To subscribe to messages sent by the driver, the client program calls SiOpen (as demonstrated in the TestSiapp demo).
If the Unity Engine does not allow access to the low-level native window, perhaps one approach is to create a managed assembly (in C#, say) and create a wrapper to the native 3D mouse driver API. I think the TestSiapp demo can be used as a first stepping stone to building the assembly.

CarlEmail
Posts: 7
Joined: Sat Mar 23, 2019 5:27 am

Re: TDx.TDxInput.dll for .NET 4.0

Post by CarlEmail » Mon Oct 28, 2019 1:12 am

Hi NGomes, thanks for the responding.
ngomes wrote:
Mon Oct 28, 2019 1:03 am
perhaps one approach is to create a managed assembly (in C#, say) and create a wrapper to the native 3D mouse driver API.
So the assembly would then open a window in the background to receive input? Is there absolutely no way to avoid the creation of a window?

All the best
Carl Emil

ngomes
Moderator
Moderator
Posts: 2150
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: TDx.TDxInput.dll for .NET 4.0

Post by ngomes » Mon Oct 28, 2019 2:37 am

CarlEmail wrote:
Mon Oct 28, 2019 1:12 am
So the assembly would then open a window in the background to receive input? Is there absolutely no way to avoid the creation of a window?
Correct. Having a window is required to use the driver API.

CarlEmail
Posts: 7
Joined: Sat Mar 23, 2019 5:27 am

Re: TDx.TDxInput.dll for .NET 4.0

Post by CarlEmail » Mon Oct 28, 2019 7:02 am

ngomes wrote:
Mon Oct 28, 2019 2:37 am
Having a window is required to use the driver API.
Does the window need to be focused for input to be received?

ngomes
Moderator
Moderator
Posts: 2150
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: TDx.TDxInput.dll for .NET 4.0

Post by ngomes » Mon Oct 28, 2019 12:37 pm

CarlEmail wrote:
Mon Oct 28, 2019 7:02 am
Does the window need to be focused for input to be received?
No but it should be created by the process that creates the focus window. Ideally, you'd want to have the focus window as the parent of the hidden window or somewhere along the parent hierarchy.

CarlEmail
Posts: 7
Joined: Sat Mar 23, 2019 5:27 am

Re: TDx.TDxInput.dll for .NET 4.0

Post by CarlEmail » Fri Nov 08, 2019 5:47 am

The TestSiapp example app needs window (Form) focus to receive input. I wonder if you have any hints how to make it work while unfocused?

ngomes
Moderator
Moderator
Posts: 2150
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: TDx.TDxInput.dll for .NET 4.0

Post by ngomes » Fri Nov 08, 2019 7:56 am

CarlEmail wrote:
Fri Nov 08, 2019 5:47 am
The TestSiapp example app needs window (Form) focus to receive input. I wonder if you have any hints how to make it work while unfocused?
Refer to SiGrabDevice in the SDK documentation. It will allow your program to receive 3D mouse data when the process loses input focus.

450302324@qq.com
Posts: 4
Joined: Mon Nov 04, 2019 7:50 pm

Re: TDx.TDxInput.dll for .NET 4.0

Post by 450302324@qq.com » Wed Nov 20, 2019 7:08 pm

I met same problem which is that initialize driver in unity.I want to implement that by getting the message which windows send to unity,and I call the CallWindowProc method.I can get the unity main window by unity's process.However I got message failed.

Code: Select all

 const int GWL_WNDPROC = -4;
        const int WM_SIZE = 0x0005; 
        //自定义消息处理程序
        private IntPtr CustomWndProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam)
        {
//            if (msg==WM_SIZE)
//            {
                Debug.Log("msg");
//            } 
            return CallWindowProc(OldWndProc, hWnd, msg, wParam, lParam);
        }

        public void Start()
        {
            Debug.Log("start monobehaviour");
            this._WndProc=new CallBack(this.CustomWndProc); 
            //开始拦截消息
            OldWndProc = SetWindowLong(GetForegroundWindow(), GWL_WNDPROC, this._WndProc);
        }
Is this feasible?in addition, can it work when unity build to exe?

ngomes
Moderator
Moderator
Posts: 2150
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: TDx.TDxInput.dll for .NET 4.0

Post by ngomes » Thu Nov 28, 2019 5:05 am

450302324@qq.com wrote:
Wed Nov 20, 2019 7:08 pm
Is this feasible?in addition, can it work when unity build to exe?
Not entirely sure I follow what you're asking, 450302324. I recall seeing separate project that had support for 3Dconnexion device in Unity. Search for "SpaceNavigator" or "3Dconnexion" the Unity "Asset Store". Perhaps you can find an example that fits what you're working on.

CarlEmail
Posts: 7
Joined: Sat Mar 23, 2019 5:27 am

Re: TDx.TDxInput.dll for .NET 4.0

Post by CarlEmail » Wed Mar 04, 2020 3:13 am

ngomes wrote:
Thu Nov 28, 2019 5:05 am
I recall seeing separate project that had support for 3Dconnexion device in Unity. Search for "SpaceNavigator" or "3Dconnexion" the Unity "Asset Store". Perhaps you can find an example that fits what you're working on.
The Asset Store product your speak of is broken. It only works in the editor, not in builds. As far as I am aware of there is currently no solution for Unity builds.

https://assetstore.unity.com/packages/t ... river-9774
https://forum.unity.com/threads/spacena ... st-5544775

ngomes
Moderator
Moderator
Posts: 2150
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: TDx.TDxInput.dll for .NET 4.0

Post by ngomes » Wed Mar 04, 2020 5:38 am

There's a .NET sample in the 3DxWare SDK. Refer to the siapp.cs file. It has the necessary methods (native interop) to add support for 3D mice in C# programs. The same approach will work with applications based on Unity.

Hightree
Posts: 20
Joined: Fri May 11, 2007 1:09 am

Re: TDx.TDxInput.dll for .NET 4.0

Post by Hightree » Wed Mar 04, 2020 8:29 am

Hi, I'm the author of the SpaceNavigator Unity driver.
I'm aware of the .net example that's being referred to, I've successfully tested that method in Unity.
This research branch holds the code of that test https://github.com/PatHightree/SpaceNav ... connection
So the fundamentals work, but there still is a lot of coding, testing and publishing remaining to get this working in a new version of the driver.
Unfortunately, I can only work on this project occasionally, as life gets in the way...
Hit any user to continue.

Post Reply