|
|
@ -8,10 +8,10 @@ using UnityEngine.UI; |
|
|
|
|
|
|
|
public class TrackballInputManager : MonoBehaviour |
|
|
|
{ |
|
|
|
const float defaultMiceSensitivity = 2f; |
|
|
|
const float defaultMiceSensitivity = 1.5f; |
|
|
|
const float upMultiplier = .5f; |
|
|
|
const float accelerationThreshold = 40; |
|
|
|
const float accelerationMultiplier = 2; |
|
|
|
const float accelerationThreshold = 120; |
|
|
|
const float accelerationMultiplier = .75f; |
|
|
|
|
|
|
|
[DllImport("LibRawInput")] |
|
|
|
private static extern bool init(); |
|
|
@ -65,7 +65,25 @@ public class TrackballInputManager : MonoBehaviour |
|
|
|
Cursor.lockState = CursorLockMode.Locked; |
|
|
|
Cursor.visible = false; |
|
|
|
|
|
|
|
//josh's desktop devices
|
|
|
|
_ignoredDevices.Add(4468289); |
|
|
|
|
|
|
|
//josh's laptop devices
|
|
|
|
_ignoredDevices.Add(75111393); |
|
|
|
_ignoredDevices.Add(1265500329); |
|
|
|
_ignoredDevices.Add(579863325); |
|
|
|
_ignoredDevices.Add(1384081); |
|
|
|
_ignoredDevices.Add(188554181); |
|
|
|
_ignoredDevices.Add(1331371593); |
|
|
|
_ignoredDevices.Add(1834746285); |
|
|
|
_ignoredDevices.Add(170921507); |
|
|
|
_ignoredDevices.Add(381291525); |
|
|
|
_ignoredDevices.Add(254348147); |
|
|
|
_ignoredDevices.Add(254282139); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void OnDestroy() |
|
|
@ -109,8 +127,16 @@ public class TrackballInputManager : MonoBehaviour |
|
|
|
{ |
|
|
|
float dx = ev.x * defaultMiceSensitivity; |
|
|
|
float dy = ev.y * defaultMiceSensitivity; |
|
|
|
if (Mathf.Abs(dx) > accelerationThreshold) dx *= accelerationMultiplier; |
|
|
|
if (Mathf.Abs(dy) > accelerationThreshold) dy *= accelerationMultiplier; |
|
|
|
if (Mathf.Abs(dx) > accelerationThreshold) |
|
|
|
{ |
|
|
|
print("hit acceleration threshold x"); |
|
|
|
dx *= accelerationMultiplier; |
|
|
|
} |
|
|
|
if (Mathf.Abs(dy) > accelerationThreshold) |
|
|
|
{ |
|
|
|
print("hit acceleration threshold y"); |
|
|
|
dy *= accelerationMultiplier; |
|
|
|
} |
|
|
|
|
|
|
|
if (dy < 0) |
|
|
|
dy *= upMultiplier; |
|
|
|