• 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 SASWO · Aug 03, 2015 at 04:05 AM · programmingbeginnerlearningunity4.3programming-basics

Help with Input.GetAxis???

On one of the chapters about programming in this book im learning from, on one of the script examples there is a line consisting of input.getaxis for mouse detection. This is the line of code:

target.transform.Rotate(Input.GetAxis("Mouse Y") 3F, -Input.GetAxis("Mouse X") 3F, 0F);

I was wondering why there is a minus sign before the second Input.GetAxis? and does this make any difference whether it is there or not. When i run the code it doesnt appear to make any difference whether to minus sign is there or not...

(Btw I am using Unity 4.3 if that makes any difference)

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by allenallenallen · Aug 03, 2015 at 05:49 AM

Here, if you're new to programming, Unity Documentation comes in real handy: http://docs.unity3d.com/ScriptReference/Input.GetAxis.html

Copied from the documentation: "If the axis is setup to be delta mouse movement, the mouse delta is multiplied by the axis sensitivity and the range is not -1...1."

Putting a negative in front should switch the direction of whatever you want to accomplish. It SHOULD make a difference. Either you didn't notice or there is another script that changes the rotation again elsewhere.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Need an in-depth explanation on this code. 2 Answers

Gameplay Android 0 Answers

I need help with basic scripting. 4 Answers

Possible to use if-statement using the ?-operator with only a single statement? 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges