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 Kninja · Jul 21, 2011 at 09:23 AM · rotationfpscontrollerlogitech

Rotation with Right Stick

I have the Logitech F710 controller and I am trying to get the rotation of a Character, like in most FPS games where you move the stick left and the character looks left and stops when you let go of the stick.

Comment
Add comment · Show 1
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 Kninja · Aug 09, 2011 at 05:02 PM 0
Share

I meant the Right stick not the left. Sorry for the confusion. I am asking how to get the right stick to rotate the player like in a FPS game.

2 Replies

· Add your reply
  • Sort: 
avatar image
9

Answer by aldonaletto · Aug 10, 2011 at 12:32 AM

I suppose this controller will appear in the Input manager like any other gamepad. Usually the left stick is associated to the "Horizontal" and "Vertical" axes, and to access the right stick you will have to create two new axes in the Input manager (menu Edit/Project Settings/Input). Increment by two the Size parameter at the top of the Input Manager, then name the new axes as "RightH" and "RightV" (for instance), and set their characteristics. In my joystick (a popular chinese generic gamepad), RightH is the 3th axis, and RightV is the 5th one:

alt text

If you just want the camera to look right/left/up/down with the right stick, you can attach to the Main Camera a script like this:

function Update () {
  var angH = Input.GetAxis("RightH") * 60;
  var angV = Input.GetAxis("RightV") * 45;
  transform.localEulerAngles = Vector3(angV, angH, 0);
}
If you're using the First Person Controller prefab, disable MouseLook.js in the Main Camera (MouseLook also exists in the First Person Controller, but it's used to rotate the character right and left - don't disable this instance).
Comment
Add comment · Show 1 · 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 KBod8802 · Jan 05, 2016 at 08:27 AM 0
Share

I get an error when I try that script. unity tells me there is a Type when it expects a variable, value, or method group. I'm new to coding so can you explain to me the problem and how to fix it? @aldonaletto

avatar image
2

Answer by amirkrd · Apr 14, 2016 at 07:57 PM

hes right, but he forgot the "new" Beside the "Vector3(angV, angH, 0);" IF UR ON C-SHARP...C#

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Referencing an object from one script to another, script reference doesn't help :/ 0 Answers

[FPS] Is it good to have the same character for AI and Players ? 1 Answer

Rotate object based on another rotation above a certain threshhold 1 Answer

Torque forces or Quaternion transforms for hovercraft rotations? 2 Answers

Rotating the player animation also rotates the player 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