0

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?

Termininja
  • 6,620
  • 12
  • 48
  • 49
cocos2dbeginner
  • 2,185
  • 1
  • 31
  • 58

1 Answers1

6
float angle = atan2f(vel.y, vel.x);
Jim Blackler
  • 22,946
  • 12
  • 85
  • 101