将SKShape节点绑定到CGPathGetCurrentPoint

时间:2014-02-18 14:44:08

标签: ios objective-c sprite-kit skshapenode

我尝试将SKShapeNode绑定到我的圈子的CGPathGetCurrentPoint。但似乎路径没有移动。

    CGPoint d;
...
myPath = CGPathCreateMutable();
CGPathAddArc(myPath, NULL, 0,0, 60, 10, M_PI*2, YES);

 arc = [SKShapeNode node];
 arc.path = myPath;
...
[self  addChild:arc];

这里一切都好。然后我将球连接到圆弧

ball = [SKShapeNode node];
ball.path = ballPath.CGPath;
[self addChild:ball];
...
d = CGPathGetCurrentPoint(arc.path);
 ball.position =  CGPointMake(d.x, d.y);

touchesMoved中,我为我的弧放置了旋转代码

arc.zRotation+=angleRadians*4;
d = CGPathGetCurrentPoint(arc.path);
 ball.position =  CGPointMake(d.x, d.y);

没有任何反应。我希望球附着到电弧电流点并随之移动。

0 个答案:

没有答案