I'm developing a simple app that needs to spawn and drag multiple UIImageViews with some simple physics so they can interact with each other. Objective-Chipmunk looks like the best bet however I'm having trouble implementing the MultiGrab functionality and there isn't much in the way of documentation.
The Multgrab demo uses Cocos2D - and I'm trying to implement it without Cocos2D as I don't really want the overhead of having to use it (I don't need it in this app at all).
Does anyone know if I must use Cocos2D or whether I can in fact use Multigrab on it's own?
I'm creating a space:
Code: Select all
space = [[ChipmunkSpace alloc] init]; ... setup
Code: Select all
multigrab = [[ChipmunkMultiGrab alloc] initForSpace:space withSmoothing:cpfpow(0.8, 60.0) withGrabForce:20000];
Code: Select all
FallingButton *fallingButton = [[FallingButton alloc] initWithPosition:cpv(200, 200) inSpace:space]; ... setup
Code: Select all
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"touch began");
for (UITouch *touch in touches)
{
CGPoint location = [touch locationInView:[touch view]];
[multigrab beginLocation:location];
}
}
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"touch moved");
for (UITouch *touch in touches)
{
CGPoint location = [touch locationInView:[touch view]];
[multigrab updateLocation:location];
}
}
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"touch ended");
for (UITouch *touch in touches)
{
CGPoint location = [touch locationInView:[touch view]];
[multigrab endLocation:location];
}
}
Any help would be appreciated, Cheers
Emile