Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 horatiu665 · Oct 03, 2013 at 01:40 PM · inputexternalexternal-applicationunity input

How can I add an Input Axis from a script, input coming from an external program?

For my game, I have made a class that creates a server connection with an external C# Windows Presentation Foundation application. The external application is sending data to Unity in the format of strings of text.

In my case, the external program is sending multiple mouse input data, formatted like this:

 "M0|2|-157"

where M0 signifies the ID of the mouse being moved, 2 and -157 being the deltaX and deltaY values. I extract the relevant information from those strings, put it in a bunch of variables and use it in the game.

I want to implement a script to add multiple input axes to the Unity Input class, with the information provided by the program, so that another might use my code by simply executing my script and accessing, for instance:

 Input.GetAxis("Multiple Mouse 1 X")

or

 Input.GetAxis("Multiple Mouse 3 ScrollWheel");

but I couldn't find anything about how to add axes through the code, and how to feed them with values of my own, not just create axes based on the keyboard input or mouse input, because that doesn't work for multiple mice.

Any help is appreciated. Please ask for clarifications if needed.

Comment
Add comment · Show 3
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 Freaking-Pingo · Oct 03, 2013 at 02:38 PM 0
Share

So just to make sure I have understood this correctly, you are trying to make a secondary mouse work in your unity project from a remote location?

I am not completely sure about this, I don't think it is possible to add axis during runtime, and also I don't understand for what purpose?

If it is because you want to apply your mouse movements to some GameObject's position in the game then you simply just apply it directly.

 someGameObject.transform.Translate(2, -157, 0);

Axes are used to extract data from joystick, control pads, keyboards and mices more easily. If your already are receiving these values from a remote location then I don't see the purpose of creating axes runtime.

avatar image robertbu · Oct 03, 2013 at 02:41 PM 1
Share

You could certainly create your own class with methods that mimic GetAxis():

 $$anonymous$$yInput.GetAxis("$$anonymous$$ultiple $$anonymous$$ouse 1X");
avatar image horatiu665 · Oct 04, 2013 at 09:55 AM 1
Share

Of course I can apply the movement as you described. $$anonymous$$y goal is to have a nicer interface to do so. I am receiving input data from somewhere else than through the Input class, and I wished to have it in the same place. As it turns out from docs and other people I talked to, it's actually not possible to change Input in any way, so I resolved to just make a new class like robertbu said. For now.

0 Replies

· Add your reply
  • Sort: 

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

15 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Add Cursor (Top-Down-Shooter) 1 Answer

Why is this script showing all keycodes except shift? 2 Answers

Strange increment counter 1 Answer

How can I access other scripts and their functions? 3 Answers

Accessing external scripts (yet again) 2 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