I do not find what s the problem. I am using ccpToAngle() to find an angle of vector but can t get proper angle. My ball is launched/initial position at cpp(170,40) and using swipe i want to throw it.
I wrote to find an angle,
-(void) ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event {
CGPoint location = [touch locationInView: [touch view]];
CGPoint vector = ccpSub(location, ccp(170 ,40));
normalVector = ccpNormalize(vector);
float angleRads = ccpToAngle(normalVector);
float angle = CC_RADIANS_TO_DEGREES(angleRads);
}
但是,如果一刀阔.,就会增加角。 我认为,从同一线/方向来看,gle角应当每次都一样。 但是,在这里,我只看到70到90度的角,如果 more子更长,角就接近60,66度。
我想从0到180度。 是否有可能将ccp(170,40)视为轴源和化合物;在Cocos2d找到病媒的视角?
增 编 提前。