- Home /
Get "Scroll Wheel" axes from Windows Trackpad
Hi there,
I'm developing a game on a Windows based Toshiba Satellite and am having trouble retrieving the input from my Trackpad's scroll function.
I can currently use Input.GetAxis("Mouse ScrollWheel");
which works fine for mouse scrolling, but it does not receive input from my trackpad. The trackpad's vertical scrolling works fine in the Unity Editor and every other application on my PC.
Researching the issue I haven't been able to find anything on the subject, as all the existing threads talk about retrieving input for OSX. I am also unable to use one suggested method of using a call during OnGUI as I am using the NGUI package. I tried listening for different JoyStick axis but none of them (tried 1-5) return any result.
Anyone else encountered this before, or should the track pad automatically send scroll wheel events as it does on MacOS?
Answer by Troutmonkey · Jun 11, 2014 at 06:24 AM
Hmm, it would seem that I can use onGUI calls still
public static float MouseScroll
{
get
{
float mouseScroll = Input.GetAxis("Mouse ScrollWheel");
if (mouseScroll != 0)
return mouseScroll;
else
return _padScroll;
}
}
//Get TrackPad Scroll
void OnGUI()
{
if (Event.current.type == EventType.ScrollWheel)
_padScroll = -Event.current.delta.y / 100;
else
_padScroll = 0;
}
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
How to set up controls for Mobile Device (2D Space Shooter)? 1 Answer
Do I Need a Mac to Make a Game for the iPhone? 1 Answer
Sending a gameobject over network with RPC? 2 Answers
Unity Dead Frontier errors 0 Answers