I have a _ballBody b2body and i've to apply force to it and throw it in a particular direction.
the statements i am using are in cctouchesended:
UITouch *myTouch = [touches anyObject];
CGPoint location = [myTouch locationInView:[myTouch view]];
location = [[CCDirector sharedDirector] convertToGL:location];
b2Vec2 locationWorld = b2Vec2(location.x/PTM_RATIO, location.y/PTM_RATIO);
_ballBody->ApplyForce(locationWorld, ballBodyDef.position);
I want to know where i am doing the mistake and what would be the solution???
Please help me out in this along with the gravity part.
the statements i am using are in cctouchesended:
UITouch *myTouch = [touches anyObject];
CGPoint location = [myTouch locationInView:[myTouch view]];
location = [[CCDirector sharedDirector] convertToGL:location];
b2Vec2 locationWorld = b2Vec2(location.x/PTM_RATIO, location.y/PTM_RATIO);
_ballBody->ApplyForce(locationWorld, ballBodyDef.position);
I want to know where i am doing the mistake and what would be the solution???
Please help me out in this along with the gravity part.