SCNAction.rotateByAngle 旋转在 El Capitan 或 Metal 中反转 [英] SCNAction.rotateByAngle rotation is inverted in El Capitan or Metal

查看:50
本文介绍了SCNAction.rotateByAngle 旋转在 El Capitan 或 Metal 中反转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的游戏中使用 SCNAction.rotateByAngle(...) 我会按左/右/上/下键或滑动以使对象沿该方向旋转.但是在 El Capitan 或 Metal 作为渲染器测试我的游戏会导致 3D 对象以另一种方式旋转,即左变成右,上变成下.

Using SCNAction.rotateByAngle(…) in my game I would press left/right/up/down keys or swipe to have an object rotate in that direction. But testing my game on El Capitan or with Metal as the renderer causes the 3D object to rotate the other way i.e. left becomes right and up becomes down.

我没有发现任何文档提到 El Capitan 或 Metal 中的旋转是倒转"或反转".

I haven't found any documentation mentioning that the rotation is "inverted" or "reversed" in El Capitan or Metal.

代码是:

Rotate up = SCNVector3(x:1, y:0, z:0)
Rotate down = SCNVector3(x:-1, y:0, z:0)
Rotate left = SCNVector3(x:0, y:1, z:0)
Rotate right = SCNVector3(x:0, y:-1, z:0)
SCNAction.rotateByAngle(CGFloat(M_PI_2), aroundAxis:vector, duration:1)

非常简单直接.

任何线索为什么会发生这种情况?

Any clues why this is happening?

我是否应该检查哪个操作系统正在运行或 Metal 然后应用正确的旋转?

Should I have to check which OS is running or Metal and then apply the correct rotations?

谢谢

推荐答案

在 Apple 开发者论坛中,一位 Apple 员工已经确认了这一点.

In the Apple Developer Forums, an Apple employee has confirmed this.

Apple 开发者论坛问题&回答

这是对的.rotateByAngle 上的行为是错误的(反转)在 10.11 和 iOS9 之前,现在已修复.向后兼容性确保(iOS9/10.11 之前链接的应用程序将继续运行相同).如果您正在构建一个新的应用程序并使用它API 并希望支持以前的版本,那么是的,您将不得不检查您正在运行的操作系统的版本.另一种选择是使用rotateByX:y:z:duration:"变体.

This is right. The behavior on rotateByAngle was wrong (inverted) before 10.11 and iOS9 and it is fixed now. The backward compatibility is ensured (an application linked before iOS9 / 10.11 will continue to run the same). If you are building a new application and using this API and want to support previous builds, then yes you will have to check the version of the OS you are running. Another option is to use the "rotateByX:y:z:duration:" variant.

这篇关于SCNAction.rotateByAngle 旋转在 El Capitan 或 Metal 中反转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆