# Question How to get Touch.radiusVariance with new input system?

Discussion in 'Input System' started by lthaca, May 10, 2024.

1. ### lthaca

Joined:
Feb 23, 2021
Posts:
9
Hi all,

I've just migrated to Unity's new input system and quickly realized that the new touch system no longer has a property for Touch.radiusVariance. I use this property to normalize input sizes for a range of iOS devices and without it I will be forced to rewrite a perfectly functional input class. It would be much simpler if I could recreate the radiusVariance property that Unity used in their old input system. Does anyone know how Unity calculated radiusVariance in the past?

2. ### lthaca

Joined:
Feb 23, 2021
Posts:
9
After firing up a build that uses the old input system I was able to gather some data points from a few iOS devices:

- DPI: 264
- Diagonal Pixels: 2560
- Aspect Ratio: 1.333333

iPhone 12
- DPI: 460
- Diagonal Pixels: 2789
- Aspect Ratio: 2.164103

iPhone SE
- DPI: 326
- Diagonal Pixels: 1530
- Aspect Ratio: 1.778667

After recording a variety of touch inputs, it appears that Touch.radiusVariance = the difference between 2 sequential radii / 2.

Using the iPhone SE as an example, here are some possible Touch.radius sizes:
- 12.82
- 25.65
- 38.47
- 51.31
- 64.13

The difference between each sequential radius is roughly 12.82, which also happens to be the minimum Touch.radius size for this device. If we take that difference and divide it by 2 we get 6.41, or, if recorded with double precision, 6.411896, which is the radiusVariance for this device.
i.e., radiusVariance = (38.47 - 25.65) / 2.

I feel that I am getting closer to a solution but am still unsure of how Unity determines the Touch.radiusVariance as well as the possible Touch.radius sizes for a device. For now, I will be able to set the radiusVariance by referring to a constant variable after verifying the user's device. However, I am a bit uncomfortable with this solution since there might be devices that do not fall into the categories of devices I have recorded. I would much rather be able to dynamically determine the radiusVariance of a device based on the specifications of that device.

In the meantime, I am currently exploring the radius.sqrMagnitude and radius.normalized of Unity's new input system. There seems to be very little documentation on these properties, but from what I can tell: