gpt4 book ai didi

ios - zRotation与移动不协调

转载 作者:行者123 更新时间:2023-11-29 01:25:03 25 4
gpt4 key购买 nike

我正在尝试使用 SpriteKit 制作适用于 iPhone 的 iPod Classic 游戏 Vortex( https://www.youtube.com/watch?v=LPN-vdeEsiE )。我有这段代码,因此平台围绕中心运行:

    let dx = base!.position.x - self.frame.width/2
let dy = base!.position.y - self.frame.height/2

let rad = atan2(dy, dx)

path = UIBezierPath(arcCenter: circle!.position, radius: (circle?.position.y)! - 191.39840698242188, startAngle: rad, endAngle: rad + CGFloat(M_PI * 4), clockwise: true)
let follow = SKAction.followPath(path.CGPath, asOffset: false, orientToPath: true, speed: 200)
base?.runAction(SKAction.repeatActionForever(follow))

但问题是节点的 zPosition 指向路径而不是中心,如您所见 here .

它应该以此方向旋转:enter image description here

请有人帮我解决这个问题,我将不胜感激。谢谢

最佳答案

在我看来,您的飞船旋转角度偏离了 90 度。似乎最简单的解决方案就是将源图像旋转 90 度。这样您根本不需要更改代码。

关于ios - zRotation与移动不协调,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34110934/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com