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 jahroy · Nov 03, 2011 at 12:15 AM · inputmousescrollwheelscroll-wheel

Is it possible to distinguish between mouse and trackpad scroll?

Is it possible to determine whether the user is using a laptop trackpad or a mouse scrollwheel when using Input.GetAxis("Mouse ScrollWheel")?

For whatever reason, using two fingers to scroll on a MacBook Pro trackpad is much more sensitive than using the scrollwheel on a mouse.

It would be great to be able to use a different speed factor for Mac trackpad input.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by TheOfficialSkara · Sep 08, 2016 at 04:23 AM

I realize I am nearly 5 years late, but the answer could still be relevant to developers today.

Unfortunately there is no apparent way to distinguish between the two inputs on Mac, as the Input.GetAxis(), Input.mouseScrollDelta, and Event.current.delta methods of receiving scroll delta are all equivalent.

However on Windows there is the following solution:

Since Input.mouseScrollDelta doesn't pick up on a touchpad scroll and Event.current.type (in the OnGUI method) does, you can detect this and handle them independently.

 void OnGUI () {
     if (Event.current.type == EventType.ScrollWheel) {
         if (Input.mouseScrollDelta.y == 0) {
             // Handle touchpad scroll using Event.current.delta.y
         } else {
             // Handle mouse scroll using Input.mouseScrollDelta.y
         }
     }
 }
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 floky · Nov 17, 2016 at 11:56 AM 0
Share

Hi! Noticed the same issue on Unity 5.3.5p7. "Input.mouseScrollDelta" or using "$$anonymous$$ouse ScrollWheel" axis doesn't pick up input from laptop trackpad. $$anonymous$$ust be a Unity bug.

avatar image gregsaywhaat · Jul 19, 2019 at 02:33 AM 0
Share

Bless you for sharing this. Despite the fact I would consider this to be a (pretty serious) bug, three years later, developers still have to handle all of their mouse events twice. This information was also REALLY hard to find, since so many people are asking questions about the janky mouse handling in Unity.

avatar image
0

Answer by d1favero · Dec 15, 2011 at 06:06 PM

Nobody knows how???

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 jahroy · Dec 15, 2011 at 06:35 PM 0
Share

I would not consider that an answer.

Please use comments unless you have a solution.

That way you don't get peoples' hopes up...

avatar image
0

Answer by Robotron18 · Nov 25, 2014 at 11:23 AM

Try to resolve in WinAPI. But system see trackpad like a mouse.

 [DllImport("user32.dll", SetLastError = true)]
 static extern bool SystemParametersInfo(uint uiAction, uint uiParam, IntPtr pvParam, uint fWinIni);
 
 bool fResult;
 IntPtr aMouseInfo;
 
 void Start()
 {
   fResult = SystemParametersInfo(0x101E, 0, aMouseInfo, 0);
   if (fResult)
   {
     print("Info: " + aMouseInfo);
   }
 }

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

7 People are following this question.

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

Related Questions

Linux and Mouse Wheel,Linux and Mouse ScrollWheel 0 Answers

How to use Trackpoint middle mouse button for scrolling, 1 Answer

How to get ScrollWheel values using a laptop touchpad? 1 Answer

Mouse ScrollWheel and character Y axis movement 1 Answer

How to Move a Cube 3 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