- Home /
how to identify physical objects on a touch screen.
how to identify physical objects on a touch screen? like :http://www.youtube.com/watch?v=Mxz3iSLqSLM
can give me some idea and test project to learn more how to do
Answer by dadika4 · Aug 19, 2015 at 06:14 AM
You can do it like this. It is all about the cards that the guy is putting on the tablet. Cards have touch pads inplemented and lets say number one had 3 touch pads so the code must be.
if (Input.touchCount == 3) {
Instantiate(numberone, spawn.transform.position, spawn.transform.rotation);
}
You can see that when he picked up the cards he touched the pad and gave an info about touches and for a slight moment a number instantiated. I know he asked this long time ago but its fun for me to answer. :)
Answer by ariesanu_stephan · Aug 18, 2015 at 08:41 PM
Hi,
this might be harder than you expect it to be. First of all you can't detect any object, as they say in the videos description, the objects they use have some form of conductive foam on them. This is needed as the touch screen only registers touches from objects that are conductive (this is why you can't use your touchscreen with gloves or pencils).
My best guess is that the foam is attached on the back in a certain pattern, and that pattern is then detected and interpreted via script. Imagine something similar to letters written in books for the blind. There are multiple dots in a certain pattern and this pattern is then interpreted as a letter. Same principle here:
-you attach dots of conductive foam on the back of an object;
-you put it on the screen;
-you read the position of those dots from Input.touches;
-you choose one of the dots and see where the others are in relation to it;
-if the dots are arranged a certain way you interpret the pattern as corresponding to a certain real-life object, else you try starting from an other dot till you checked them all;
-you program unity to display a certain image on the screen if you find a pattern that fits the ones you predefined.
I hope this helped you out.
Answer by Eno-Khaon · Aug 18, 2015 at 08:54 PM
The author mentions in the comments of that video approximately how it was done, actually. The key element seemed to be the positioning of the foam on the bottom(s) of the numbered panels.
My guess would be that, as an example, he made use of the multi-touch capabilities of the iPad and read in the distance between or shape of the contact points.
For example, it could be done as something like:
O = foam pad
+-------------------+
| |
| O |
| |
| | ONE
| |
| |
| O O |
| |
+-------------------+
+-------------------+
| |
| O |
| |
| | THREE
| |
| |
| O O |
| |
+-------------------+
In both cases, the bottom two pads would be used for calibration. They're always closer to each other than the third one, so they would automatically be readable and scalable with the physical screen size. The third would actually be used to determine which number panel is placed by calculating the triangle formed by the three.
Since 3+ finger detection generally seems to be specific to Apple, it's probably also the most viable platform for this specific conceptual setup.
Edit: Also, having 3 foam pads would surely be convenient for preventing damage to the screen.
Answer by dadika4 · Aug 19, 2015 at 06:33 AM
Theere are many ways to get pass this but i just pointed out how he did it. Watch closely at 9 second of the clip. It has nothing to do with positioning but only counting touch. When he took the number 1 of the screen he touched the screen more than he should. Again my opinion. :)