Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by RobW81 · Sep 13, 2011 at 07:04 AM · inputhardware

Custom Hardware through Input Manager

I have been looking around trying to find any info on making a plugin or a .Net library that will allow me to use a custom piece of hardware through the input manager. What I want to do is take, say a head tracker and write some code to make it compatible with the input manager.

The goal is write one line of code to control the camera rotations based on the input manager. This will allow me setup the input manager so I can use the mouse, the arrows or the head tracker to rotate the camera. The benefit to this is if someone doesn't have a head tracker they can use the mouse to rotate the camera and I don't have to write special conditions to check if the hardware is present.

Is there way to write a plugin or library that follows some set of rules to be compatible with the input manager? All of the tracking devices out there have APIs to make it easy to use in a library or a plugin but I can't find anything about making it usable through the input manager. I would really like find out if this is possible because it can save time prototyping new hardware and eliminate special hardware logic.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by thelackey3326 · Sep 13, 2011 at 05:55 PM

Unity does not currently provide a way to create a custom input device. I've added a feature request in the Wishlist/Feedback, but it doesn't have very many votes. I think this feature is a huge weak spot that reduces Unity's candidacy as a development platform in markets that don't exactly fit into the same mold as commercial video games.

Here's a link to the Wishlist. Please upvote!
Expose Input system for custom devices

Hardware that the OS does not see as a game input device (joystick/gamepad), a keyboard, or a mouse will not be "seen" by the Unity Input Manager and will require a plugin. My suggestion would be to create an event system that will send out input changes from all relevant devices and have your object subscribe to that event. Or, you could wrap all valid input devices with a single class which would do its own polling, and then have your object poll that class.

Depending on how much time you have for development, a custom driver could probably be created to make your input device look like a game controller at the OS level. Unity would then likely treat it as any other joystick device.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image RobW81 · Sep 14, 2011 at 01:41 AM 0
Share

I was afraid that was the answer. I wanted to avoid writing the drivers for different hardware devices but figured more then likely I would have to write my own hardware input system. It just makes sense to have generic system for all hardware inputs so you can swap out new devices without change your code.

avatar image thelackey3326 · Sep 14, 2011 at 11:20 PM 0
Share

Input seems to be one of the more ignored systems in Unity. The available workarounds also tend to be platform specific and/or incompatible with the web player. Hopefully this will be addressed at some point.

If my answer was satisfactory, would you please "accept" it?

avatar image
0

Answer by ShawnFeatherly · Jan 12, 2018 at 04:18 AM

If it's a HID device you can use https://github.com/mikeobrien/HidLibrary . I tried this for GriffinPowermatUsb and found it works, but locks up the Unity3D editor. It may work fine for builds.

I ended up using AutoHotKey with this script https://autohotkey.com/board/topic/38015-ahkhid-an-ahk-implementation-of-the-hid-functions/ It requires installing additional software on the machine.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

how to get a custom built controller/joystick working with unity game? 1 Answer

Make custom input devices available to scripting via "Input" 2 Answers

Thrust controller (hardware) as input in Unity 0 Answers

Create an input module to support exotic input devices 1 Answer

Use of volume hardware keys on Android? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges