- Home /
Detect strength of touch - Unity Touch API
Is it possible to detect the strength of a touch?
Answer by AngryOldMan · Jul 07, 2011 at 01:26 PM
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).
iPad 2 and iPhone 4 have gyroscopes that let you get touch strength..
No they don't. Gyroscopes are for detecting degrees of rotation and coupled with accelerometers they can detect a number of things but in no way can a gyroscope detect pressure on any imac device. Ipads are the "height" of apple current apple technology and even they cannot detect pressure. They use biometric mulit-touch sensors and they do not pick up pressure of touch. In fact a company has been working on using a stylus with pressure sensitivity specifically for an ipad but otherwise as standard no touch pressure.
The solution below for using accelerometer + gyro might be a way to get touch strength via gesture impulse - it's an infinitesimal spike with a tiny twist
Answer by CHPedersen · Jul 11, 2011 at 12:43 PM
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. :P
If you install $$anonymous$$ultiTouch Visualizer 2 app on your Android device (I tested this with HTC Desire and Asus Transformer) you can track/visualize each finger/touch. The radius of the circle represents the amount of pressure. This proves that at least these 2 devices(hardware) and Android SD$$anonymous$$/API(software) has support for it. The only question is does Unity API has direct support for it or do we need to make a Unity/Android SD$$anonymous$$ plugin.
Update:
$$anonymous$$aybe pressure is just the radius of the contactpoint. When you press harder the radius of the contactpoint is also increasing but this doesn't necessarly also mean more pressure for example when you have big fingers. I have to test this with a special tabletstylus with a constant radius and using different forces.
Answer by pcote · Jul 18, 2011 at 12:31 AM
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.
Answer by nixtwiz · Jul 05, 2012 at 03:49 AM
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.
$$anonymous$$aybe a bit late, but I came here looking for exactly pcote's answer. Garageband uses the accelerometer indeed. Not the radius of the touch.
Answer by christophergoy · Dec 05, 2015 at 04:35 PM
Unity began supporting Touch pressure in Patch 5.2.2p1. Look for Touch.pressure and Touch.maximumPossiblePressure.
Your answer