x


Can I use my own input device?

Hi,

My problem seems fairly simple. I am a research student at a Lab, and this lab has developed a haptic 3d input device. Naturally I am to do something with this device and Unity. I have DLLs to use in C# (using PInvoke).

So would it be possible to use both the device as a pointing device (like a 3D mouse) and an haptic device (force feedback) if I was to buy the Pro version of Unity? Can you add your own input device into unity?

more ▼

asked May 21 '10 at 08:45 AM

simaldeff gravatar image

simaldeff
81 2 4 4

(comments are locked)
10|3000 characters needed characters left

4 answers: sort voted first

Yes you can, provided A) you have Pro (which can use Plugins, and B) the project is a stand-alone executable (browsers have security limitations).

Here's a similar Question where I listed some sample code that might make it more clear: How to import Neurosky Mindset data into Unity

On second thought, that code might be misleading - Neurosky provides some boilerplate code in a C# file, that is required to call the .dll. If you are starting from scratch, you would have to write code to use the Plugin that looks something like this:

// This tells unity to look up the function FooPluginFunction inside the plugin named "PluginName"
[DllImport ("PluginName")]
private static extern float FooPluginFunction ();

And you can download Unity Pro Trial. The trial version is only valid for 30 days, but if this is a short, one-time project, that might be enough to complete it.

more ▼

answered May 21 '10 at 01:45 PM

Cyclops gravatar image

Cyclops
7.1k 33 63 115

(comments are locked)
10|3000 characters needed characters left

Hi, sorry to budge in with another question relating to "using my own input device". I am using a 3D input device, which I believe is similar to haptic, posted by simaldeff. I have the DDL in the plugin folder. I was able to read the data from the input device using the DLL API.

I am now experiencing this problem. When I move the device, the data I read and displayed using Debug.Log, lagged by about 1 second. This is not good because whatever I want to animate in Unity cannot respond to me instantanteously. I have no idea what causes the lagging.

I wrote another program in C++ to read the data from the same DLL and display it. Interestingly, there is no lagging at all. Seem like the problem is interaction between Unity and the DLL.

I have been looking through the forum for anyone with similar problem and any advice and pointers will be deeply appreciated. Thanks.

more ▼

answered Jul 14 '11 at 06:22 AM

ferraribeng gravatar image

ferraribeng
1 1 1 3

(comments are locked)
10|3000 characters needed characters left

... A follow on...

I also am trying to link in a haptic device... I have it running on Android through bluetooth and windows through c/c++/and c# dlls

I understand that I should be able to get this running no problem with windows, but what about android or iphone?

Will Unity allow my code to connect to a bluetooth device and send and recieve packets?

If not could I do it if the device has an IP address with udp/tcp?

more ▼

answered Dec 16 '10 at 03:10 PM

Greg 4 gravatar image

Greg 4
5 5 6 7

(comments are locked)
10|3000 characters needed characters left

I have been able to call a objective-c dll from C# scripts thanks to the info you provided. However, I wish to receive callbacks from my C++ dll. I thought of using a delegate to catch the callbacks as I have done before, but I get errors saying I'm trying to JIT compile my delegate. Is there a way to get callbacks from a dll in unity?

more ▼

answered Jan 20 '11 at 09:39 PM

Texhas gravatar image

Texhas
1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x953
x392
x231
x199
x5

asked: May 21 '10 at 08:45 AM

Seen: 1927 times

Last Updated: Jul 14 '11 at 06:22 AM