Detect tangible objects on iOS. Tangible objects are physical objects detected on screen.
Currently, TangibleDetector detect only one object with 3 contact points.
Beta version : V 0.9.1
To see a demo video, click here
Distance to point :
Add "TangilbleDetector.h" and "TangilbleDetector.m" in your xcodeprojet. Import the .h file :
``` objective-c #import "TangilbleDetector.h" ```Add Delegate TangibleDetector :
``` objective-c @interface M_01 : CCLayer ```Init the TangilbleDetector and multitouch :
``` objective-c TangilbleDetector *tangibleDetector = [[TangilbleDetector alloc]init]; self.tangibleDetector.delegate = self; self.view.multipleTouchEnabled = YES; ```- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{[self.tangibleDetector touchesBegan:touches];}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{[self.tangibleDetector touchesMoved:touches];}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{[self.tangibleDetector touchesEnded:touches];}
Change value to distance to touch :
``` objective-c int DistanceObjectMin = 96; int DistanceObjectLong1 = 111; int DistanceObjectLong2 = 111; ```Use delegate function in your view :
``` objective-c - (void)objectDetectedWithPosition:(CGPoint)position andAngle:(float)angle{// (CGPoint)position
// position of object
// (float)angle
// angle of object
}
-
(void)objectisNotDetected{
// if object is not Detected
}