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
0
Question by jessee03 · Nov 16, 2011 at 03:00 AM · gamepad

gamepad controls

I'm currently trying to program controls for my gamepad controller but am having issues finding enough information to program what I'm trying to do. I have changed the input to be setup to work with my logitech duel analog controller but just can't get it to work. I'm trying to get my character to move around using the left analog stick and simply move around said character with the right analog stick. If anyone has example code or anything that could help that would be amazing !

similar to this movement but using javascript and a gamepad controller.

http://www.youtube.com/watch?v=0H7171JsAqA

Comment
Add comment · Show 4
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 syclamoth · Nov 16, 2011 at 03:13 AM 0
Share

Could you please elaborate a little? I'm not sure what the problem is here! Are you having trouble reading from the analog sticks, or are you having trouble using the values once you have them?

avatar image jessee03 · Nov 16, 2011 at 05:16 PM 0
Share

I'm having trouble figuring out how to code the controls so that your able to use the analog stick to move around. I understand how to use keyboard / mouse input but not gamepad input for coding. I was trying to get my character to move around using the left analog stick similar to how the character in the angry bots unity demo or another game like metal gear solid movement.

I'm unsure on how the coding would work. Thinking something like...

If(leftAnalogStick > 0 ) {

character.direction = leftAnalogStick.direction;

character.speed = 20;

}

avatar image ScottMcG · Nov 16, 2011 at 06:19 PM 0
Share

Is "leftAnalogStick" returning any value? The problem can either be the input not being read or the input is valid but it's not applied correctly to your character.

avatar image jessee03 · Nov 16, 2011 at 06:42 PM 0
Share

The code I posted is an example of kind of what I want it to do. I know it's all incorrect because I am unsure how to code analog controls.

1 Reply

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

Answer by Eric5h5 · Nov 16, 2011 at 05:55 PM

Use Input.GetAxis, and set up the axes in the input manager.

Comment
Add comment · Show 3 · 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 jessee03 · Nov 16, 2011 at 06:02 PM 0
Share

I've setup all the controls in the input editor but I'm not sure how to program the controls into my game.

avatar image Eric5h5 · Nov 16, 2011 at 07:13 PM 1
Share

Did you read the docs for GetAxis? There's sample code for moving an object around.

avatar image jessee03 · Nov 16, 2011 at 07:30 PM 0
Share

I've tried code from the documentation but none of it seems to effect my game. I setup the joystick controls in the input manager but all it does is move my character forward and back with the left analog and rotates my character with the right. What I'm trying to do is add rotation + movement to the left analog and move the camera with the right.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Use Gamepad right analog stick instead of mouse to control crosshair movement 3 Answers

Android multiple gamepad/controller/joystick support? 1 Answer

Keyboard/Joystick Inputs Do Not Work until Mouse Clicked 0 Answers

Is there a way to fire the inspector events from code? 0 Answers

Mayflash Gamecube controller vibration 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