0
votes

I am using SpriteBuilder with Cocos2D 3.1 and I am trying to wrap my head around the logistics of this. What I want to do is get the angle the sprite is currently moving at based upon a X and Y velocity from my Chipmunk physics.

Those values are easily attained by:

sprite.physicsBody.velocity.x
sprite.physicsBody.velocity.y

Now would I use atan2 from here? I am also confused about the axis that CC_DEGREES_FROM_RADIANS is returned in. If anyone can shed some light on this trivial issue I am having, that would be swell!

1

1 Answers

0
votes

Covered here How to get Angle of velocity to rotate a bullet?

There is a really good article at http://www.raywenderlich.com/35866/trigonometry-for-game-programming-part-1 even if you know trig it's good to skim for platform specifics