Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting angle of rotation of a SKSpriteNode

Tags:

ios

sprite-kit

I have a SKSpriteNode that runs a SKAction that rotates it forever. So basically, I have the following code:

[myNode runAction:[SKAction repeatForever:[SKAction rotateBy:M_PI*2 duration:1]]];

At some point, I'd like to access the current angle at which the node is at. Something along the lines of:

float currentAngle = myNode.currentAngle;

Does anyone have an idea of how I could go about doing this? I have tried searching the docs but haven't found any "angle" or "currentAngle" property for a SKSpriteNode.

like image 652
Richard Awusi Avatar asked Feb 13 '14 07:02

Richard Awusi


1 Answers

Try This... It will give you rotation angle.

NSLog(@"%f",myNode.zRotation);
like image 121
Rajesh Choudhary Avatar answered Nov 09 '22 02:11

Rajesh Choudhary