- Home /
How to use costum device like 3dsensor in unity
hello every one We have a MTi , The MTi is an excellent measurement unit (IMU) for stabilization and control of cameras, robots, vehicles and other (un)manned equipment.The MTi is a miniature, gyro-enhanced Attitude and Heading Reference System (AHRS). Its internal low-power signal processor provides drift-free 3D orientation as well as calibrated 3D acceleration, 3D rate of turn and 3D earth-magnetic field data. the problem is this : We don't know how to use it in my unity3d engine and how to define it moving and rotating & other out puts in my game code scripts? for example We can't write a code to this and connect its movement in a simple cube in game and when we rotating sensor in real world the cube in game rotate. We can't use this sensor in unity3d please help us. more about that device in here thanks
Haven't ever tried, but if you're on a $$anonymous$$ac, as long as your device is registered as a HID, you can access it like you would do with a joystick.
Answer by Graham-Dunnett · May 08, 2013 at 08:07 PM
So, the generic answer to your question is:
Write an application in c++ or whatever you are familiar with that knows how to talk to the device. Most devices will come with a DLL or an SDK or something that lets you talk to the device. (Otherwise the device is useless). The application you write does not use Unity.
Get the application you write at (1) to dump out the essential data to a text file, or console, or something so you can see that your application works.
Extend your application so the data you write out at (2) gets written to a socket that the application opens. (You'll need a small listening application that knows to listen on the socket and it should dump out the data is reads from the socket.) You now have the app talking to a different application.
Re-write the listening app in JS or c# that runs inside Unity. Unity can now see the data that your application spits out.
Use the data that you read over the socket to change the position of your camera/gameobject/whatever in Unity.
This is the generic solution to your problem. Since I have never heard of the MTi I don't know if this approach is viable. This approach should work with Pro and free Unity.
If you have Pro, then you can write a DLL (plugin) to avoid using sockets.
we have a file C$$anonymous$$T Example Dll but don't know hot to use it. If you Don't know what is $$anonymous$$Ti I put link in my answer you can read that. thanks
I don't know how to use that DLL either. $$anonymous$$aybe the people who made it can help you.