问题
I have this:
CGPoint vel = hudLayer.rightJoystick.velocity;
CCBullet* sp = [CCBullet spriteWithFile:@"green.png"];
sp.position = player.position;
[self addChild:sp z:-10];
vel = ccpMult(ccpNormalize(vel), 300);
sp.rotation = //how to get the rotation out of the velocity?
Any help?
回答1:
float angle = atan2f(vel.y, vel.x);
来源:https://stackoverflow.com/questions/5729221/how-to-get-angle-of-velocity-to-rotate-a-bullet