简体   繁体   English

如何使用Xcode 10在SceneKit编辑器中旋转对象

[英]How to rotate an object in SceneKit editor with Xcode 10

I'm following a tutorial where you can see the Earth rotating. 我正在关注一个教程,您可以在其中看到地球旋转。 All seems really easy: you put a sphere object with SceneKit Editor and then you add a rotation action. 一切似乎都很简单:使用SceneKit Editor放置一个球体对象,然后添加一个旋转动作。 在此处输入图片说明

This is the action I'm adding: 这是我要添加的操作:

在此处输入图片说明

The thing is that in the project I download from the internet all is working perfect but when I do this in a new project my Earth doesn't rotate one single pixel! 事实是,在我从Internet下载的项目中,所有程序都运行良好,但是当我在新项目中执行此操作时,地球不会旋转一个像素! All the attributes I can see in the inspector seems to be exactly the same. 我可以在检查器中看到的所有属性似乎都完全相同。

Probably there is some silly thing I am not considering... 我可能没有考虑一些愚蠢的事情...

I wasn't able to find RotateByAxisAngle in the Apple developer documentation on SceneKit animation. 我无法在有关SceneKit动画的Apple开发人员文档中找到RotateByAxisAngle Is it possible the tutorial is slightly out of date? 教程可能会有点过时吗? You might want to try one of the other functions listed in the Apple documentation . 您可能需要尝试Apple文档中列出的其他功能之一。 Otherwise I'd try setting one of your rotation values from 0.00 to 6.28319 or 360 degrees in radians. 否则,我会尝试将旋转值之一设置为0.006.28319或弧度360度。

I had the same problem, the rotation wasn't working after adding a RotateBy Axis Angle Action , but after I updated the Angle value, it started rotating. 我遇到了同样的问题,添加了RotateBy Axis Angle Action之后旋转不起作用 ,但是在更新Angle值之后,旋转开始旋转。

To change the Angle value, just select your Action from the Actions bar and then from Attributes Inspector menu, change the Angle . 要更改Angle值,只需从Actions栏中选择Action,然后从Attributes Inspector菜单中更改Angle即可

The default Angle value is set to 0 , just change it to 1 and notice you should also set Axis values and they shouldn't be all zero, like below: 默认的Angle值设置为0 ,只需将其更改为1并注意您还应该设置Axis值,并且它们不应该全部为零,如下所示:

在此处输入图片说明

Now the rotation should work all well. 现在轮换应该可以正常工作了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM