Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MouseDeltaCheck : MonoBehaviour
- {
- public Vector2 screenPos;
- public Vector2 positionDelta;
- public Vector2 inputDelta;
- public Vector2 ratio;
- void Update() {
- Vector2 newScreenPos = Input.mousePosition;
- positionDelta = newScreenPos - screenPos;
- inputDelta = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"));
- if(inputDelta.x != 0f)
- ratio.x = positionDelta.x / inputDelta.x;
- if (inputDelta.y != 0f)
- ratio.y = positionDelta.y / inputDelta.y;
- screenPos = newScreenPos;
- }
- }
- {Change in Pixel Position} * {Axis Sensitivity} * {OS Scaling Factor} * 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement