Usage Example
using Sandbox;
public class InputMouseWheelExample : Component {
// When the component is enabled, this will run every frame.
protected override void OnUpdate() {
// If this component isn't owned by our local player, we don't process input.
if ( IsProxy )
return;
// Vertical scrolling is more common and works with all mice
if ( Input.MouseWheel.y < 0 )
Log.Info("Mouse wheel scrolled down");
else if ( Input.MouseWheel.y > 0 )
Log.Info("Mouse wheel scrolled up");
// Horizontal scrolling is less common and may not work with all mice
// For example, the Logitech MX Master 3, supports horizontal scrolling
if ( Input.MouseWheel.x < 0 )
Log.Info("Mouse wheel scrolled left");
else if ( Input.MouseWheel.x > 0 )
Log.Info("Mouse wheel scrolled right");
}
}