Detect strength of touch - Unity Touch API

Is it possible to detect the strength of a touch?

not for the vast majority of phones out there as they don’t have touch sensitivity input just touch screen position x and y parameters as excessive pressure would bust the screen. Not sure about Ipad you will have to look it up (probably not).

I’m not entirely sure how it would do that. All modern touch devices have capacitive screens (as opposed to resistive), which work by detecting where on a grid of criss-crossing wires an electrostatic field seems to be distorted because a conductor (the finger) touches the screen. The only information you have in addition to location is how much the capacitance at that particular node in the grid differs from its surroundings. Because a capacitive touch screen isn’t flexible, pressing harder doesn’t necessarily conduct power between your finger and the nodes better. It might cause your finger to make contact with more adjacent nodes because the fingertip “splats” out with the pressure, but if you tell the device to interpret a higher capacitance difference as the equivalence of more pressure, what happens if I touch the screen with something that’s a better conductor than a finger? You could cheat the system that way. :stuck_out_tongue:

Accelerometer is used to detect the strength of impact of touch in Apple’s own GarageBand App which you can get for iPad. It works for both iPad 1 and 2. There are piano keys which you can touch or mash a bit stronger, and the sound actually changes based on the strength of impact. This is a neat trick but might not be exactly what you are looking for.

It might not be the amount of pressure. Think on a 2d level. When you press on the screen, the harder you press the more you finger touches the screen, because it squishes on to the screen. Garageband may just be measuring how fast the radius of the touch increases, which tells it how fast you pushed down, thus simulating a sense of pressure.

Unity began supporting Touch pressure in Patch 5.2.2p1. Look for Touch.pressure and Touch.maximumPossiblePressure.