WebGl Mouse Controlls and Browser Behavior

Hi im building an RTS like Game and i want to release it to WebGL. It should be possible to controll the camera in the game like you controll the camera in the unity-editor scene-view.

in the unity editor my script works just fine, but the browsers behave all different. Camera Controlls feel slow and heavy.

Input.GetAxis("Mouse X")

  • Chrome: -1 < x < 1
  • Firefox: if you are fast enough you can get higher than 15
    • i dont think it grows linear
  • Unity Editor: similar to Firefox, values up to 12 can be reached (maybe higher)
    • grows more linear than Firefox (i think) but not that strong

Scrolling (zooming in my game) is the other extreme either full in or full out

Input.GetAxis("Mouse ScrollWheel")

  • Chrome and Firefox: 0.5 per tick
  • Unity Editor: 0.1 per tick

Unity Personal 5.2.1f1

For everyone having the same issues for webgl projects:
I solved it with this workaround:

var AxisMouseX = (Input.mousePosition.x - LastMousePosition.x) / Screen.width / Time.deltaTime;
var AxisMouseY = (Input.mousePosition.y - LastMousePosition.y) / Screen.height / Time.deltaTime;
LastMousePosition = Input.mousePosition;

so i use AxisMouseX instead of Input.GetAxis("Mouse X")

to fix the scroll wheel i’ve hardcoded 0.1 (not clean, but works)