ios - cocos2d 2.x : understanding ccBezierConfig beheaviour
<p><p>我一直在关注这个问题,因为不久前我问了一个 <a href="https://stackoverflow.com/questions/12430651/cocos2d-and-ios-cant-understand-use-of-control-points-using-ccbezierconfig" rel="noreferrer noopener nofollow">question</a>一位用户友好地回复我解释说有 <a href="http://www.cse.unsw.edu.au/~lambert/splines/Bezier.html" rel="noreferrer noopener nofollow">this plugin tool</a>我可以使用它来创建快速贝塞尔曲线原型(prototype)。</p>
<p>我尝试并制作了这个:</p>
<p> <img src="/image/yUAMA.png" alt="That's what I produced with the tool"/> </p>
<p>我<strong>认为</strong>它会在这个 ccBezierConfig 中得到完美的翻译:</p>
<pre><code>ccBezierConfig bezier;
self.position = CGPointMake(-10.0f, 400.0f);
bezier.controlPoint_1 = CGPointMake(160, 190.0f);
bezier.controlPoint_2 = CGPointMake(200, 190.0f);
bezier.endPosition =CGPointMake(340.0f,280.0f);
id bezierForward = ;
[self runAction: [CCSequence actions:
bezierForward, ,
nil]];
</code></pre>
<p>不幸的是,我得到的路径并不像我所期望的那样安静。角色从屏幕左上角开始移动,然后向上移动,我没有看到预期的移动。</p>
<p>任何解释我做错了什么? </p>
<p>顺便说一句..我在 iOS 6.0 上使用 Cocos2d 2.0,视网膜显示 iPod touch 第 4 代。</p>
<p>编辑:</p>
<p>另一个例子..</p>
<p>我认为这个配置会像 <a href="http://en.wikipedia.org/wiki/File:Bezier_3_big.png" rel="noreferrer noopener nofollow">this</a>然后从头到尾做对称的事情,但是“颠倒”。</p>
<p>关于我做错了什么有什么建议吗?</p>
<pre><code> ccBezierConfig bezier;
self.position = CGPointMake(0.0f, 150.0f);
bezier.controlPoint_1 = CGPointMake(-20.0f, 290.0f);
bezier.controlPoint_2 = CGPointMake(260, 290.0f);
bezier.endPosition =CGPointMake(340.0f,150.0f);
id bezierForward = ;
ccBezierConfig bezier2;
bezier2.controlPoint_1 = CGPointMake(340.0f, 10.0f);
bezier2.controlPoint_2 = CGPointMake(80, 10.0f);
bezier2.endPosition =CGPointMake(-20.0f,150.0f);
id bezierReturn = ;
[self runAction: [CCSequence actions:
bezierForward, bezierReturn, ,
nil]];
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我使用的是 CCBezierBy,但示例基于 CCBezierTo 公式。因此,如果我使用 CCBezierTo 代替 CCBezierBy,一切都会按预期工作。 </p></p>
<p style="font-size: 20px;">关于ios - cocos2d 2.x : understanding ccBezierConfig beheaviour,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/14589474/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/14589474/
</a>
</p>
页:
[1]